Post

Replies

Boosts

Views

Activity

Reply to SwiftData - Context missing for optional
I was running into this error when trying to delete an object from SwiftData when using an actual device on iOS 18 beta but not on a simulator running iOS 17. My model did have a @Relationship property attached to it as well. I added the following code when inserting an object and haven't gotten this crash the 10+ times I tried. Not idea if it's just a random coincidence or a work around for some bug. do { try modelContext.save() } catch { print(error) }
Jul ’24