Post

Replies

Boosts

Views

Activity

WidgetKit with SwiftData on macOS
Xcode: 16.1 macOS: Sequoia When I run widget preview, I got the following errors CoreData: error: Store failed to load. <NSPersistentStoreDescription: 0x156237310> (type: SQLite, url: file:///Users/user/Library/Group%20Containers/group.com.app.name/Library/Application%20Support/default.store) with error = Error Domain=NSCocoaErrorDomain Code=256 "The file couldn’t be opened." UserInfo={reason=Unknown failure to access file: 1} with userInfo { reason = "Unknown failure to access file: 1"; } Unresolved error loading container Error Domain=NSCocoaErrorDomain Code=256 "The file couldn’t be opened." UserInfo={reason=Unknown failure to access file: 1} with this code let sharedModelContainer: ModelContainer = { let schema = Schema([Company.self, Person.self]) do { return try ModelContainer(for: schema, configurations: [.init(isStoredInMemoryOnly: false)]) } catch { fatalError("error: \(error)") } }() Does anyone know why this happens and how to fix this?
5
0
196
3w
Widget Intent does not work on macOS Sequoia
Environment Xcode: 16.1 Swift 6 and SwiftUI for macOS development macOS Sequoia I have an app for macOS, and that uses an interactive widget feature. On macOS Sequoia, the widget does not display anything and widget intent doesn't work either. I tested it on macOS Sonoma and it totally works. I assume it's a macOS bug. The app has been working fine before Sequoia. Even on Xcode, when I tried to run the widget preview, Failed to load widget. The operation couldn't be completed. (WidgetKit_Simulator.WidgetDocument.Error error 4.). I could avoid the error by changing version and build numbers, but I still got The operation couldn't be completed. (CHSErrorDomain error 1103.) How am I able to fix the issue? I wanna at least know if its a bug from the app or macOS Sequoia.
0
0
130
3w
SwiftData does not cascade delete
Even if there are one-many relationship models with the cascade delete rule, SwiftData does not cascade delete items. For example, there is one school has multiple students like the following models, and even when the school is deleted, the students in the school are not deleted. This happens when a user create a school and students and delete the school immediately. Are there any workarounds for now? @Model final class School { var name: String @Relationship(deleteRule: .cascade, inverse: \Student.school) var students: [Student] = [] init(name: String) { self.name = name } } @Model final class Student { var fullName: String var school: School init(fullName: String, school: School) { self.fullName = fullName self.school = school } }
10
7
2.1k
Oct ’23