Post

Replies

Boosts

Views

Activity

Reply to Saving SwiftData in Background Does Not Update @Query
The best way I've seen online is to hook into the ScenePhase & to iterate over your data: ///struct <YourApp>: App {... .onChange(of: scenePhase) { _, newValue in if case .active = newValue { items.forEach { $0.title = $0.title } } } //Or do something like the following: modelContainer = DataModel.shared.modelContainer I don't think we're allowed to link out here, but lookup "Widget-Intermediate-Animation" on GitHub for more info & the new SwiftData History stuff. When using Shortcuts/App Intents, I've yet to find a good way to update the main UI (The data is being manipulated, but the UI isn't redrawing)... I've been using the above which works when navigating out/into a NavStack view or backgrounding & re-foregrounding the app. Ie, less than ideal, but we do what we gotta do! 😅
Jul ’24
Reply to Saving SwiftData in Background Does Not Update @Query
The best way I've seen online is to hook into the ScenePhase & to iterate over your data: ///struct <YourApp>: App {... .onChange(of: scenePhase) { _, newValue in if case .active = newValue { items.forEach { $0.title = $0.title } } } //Or do something like the following: modelContainer = DataModel.shared.modelContainer I don't think we're allowed to link out here, but lookup "Widget-Intermediate-Animation" on GitHub for more info & the new SwiftData History stuff. When using Shortcuts/App Intents, I've yet to find a good way to update the main UI (The data is being manipulated, but the UI isn't redrawing)... I've been using the above which works when navigating out/into a NavStack view or backgrounding & re-foregrounding the app. Ie, less than ideal, but we do what we gotta do! 😅
Replies
Boosts
Views
Activity
Jul ’24
Reply to SampleTrips Previews work, but not in my primary project.
After updating to Xcode 16B3 & updating the project format to Xcode 16.0, I was able to get it all up & running!
Replies
Boosts
Views
Activity
Jul ’24
Reply to SampleTrips Previews work, but not in my primary project.
So commenting out the entire DataModelSecondary actor in the sample project still works fine. In my main project, I'm still getting the same error. (the attached file, in the original post), even after commenting out the DataModelSecondary actor. 🤔
Replies
Boosts
Views
Activity
Jul ’24