Still no solution that I’ve found. I posted on the Twitter dev community as well, and no one can find a solution. With further testing, I have found that sometimes it’s the type that you’re trying to use with the @Model macro. For example, it will throw a similar thread error if you attempt to use an enum type in a model as well.
Post
Replies
Boosts
Views
Activity
Forgot to mention, I made sure to add the new MyItem type to the schema as well:
struct SwiftDataBugTestApp: App {
var sharedModelContainer: ModelContainer = {
let schema = Schema([
Item.self, MyItem.self
])
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
do {
return try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {
fatalError("Could not create ModelContainer: \(error)")
}
}()
var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(sharedModelContainer)
}
}
Note: Form should be List, otherwise this code throws another error. I am aware of this typo.