Post

Replies

Boosts

Views

Activity

Reply to iOS 18 SwiftData ModelContext reset
Found a solution that worked for me. In my case I was fetching data asynchronously using a ModelActor. The fix was I had to refetch the model data again using the modelContext model(for:) method // Async fetch of an episode from a playlist if let episode: Episode = await playlist.episode() { // This was missing and was critical. I needed to refetch the data. let episode: Episode = modelContext.model(for: episode.persistentModelID) as! Episode } There's probably a better way to structure my code to prevent this...but this worked as a fix for me where the other solutions didn't.
Sep ’24
Reply to Disable automatic iCloud sync with SwiftData
Still an issue in iOS 17 beta 6. "cloudKitContainerIdentifier" doesn't work anymore. You can't set nil or a value. You just get this error: "Extraneous argument label 'cloudKitContainerIdentifier:' in call" Even though you can't set it, it still enables CloudKit on it's own. Making it impossible to disable it.
Replies
Boosts
Views
Activity
Aug ’23
Reply to SwiftData app always at 100% cpu when idle after upgrading to Xcode 15.3
Same.
Replies
Boosts
Views
Activity
Mar ’24
Reply to iOS 18 SwiftData ModelContext reset
Found a solution that worked for me. In my case I was fetching data asynchronously using a ModelActor. The fix was I had to refetch the model data again using the modelContext model(for:) method // Async fetch of an episode from a playlist if let episode: Episode = await playlist.episode() { // This was missing and was critical. I needed to refetch the data. let episode: Episode = modelContext.model(for: episode.persistentModelID) as! Episode } There's probably a better way to structure my code to prevent this...but this worked as a fix for me where the other solutions didn't.
Replies
Boosts
Views
Activity
Sep ’24