Post

Replies

Boosts

Views

Activity

Reply to SwiftData changes made in widget via AppIntent are not reflected in main app until full relaunch
Thank you very much for the detailed answer — it really helped me understand the problem and find a working solution! I’m not sure if this is a bug or just how @Query is designed to work, but here’s what I found: In my case, I have three models: A, B, and C. Model A contains arrays of both B and C. Initially, I used @Query only to fetch model A, and then displayed the related B and C items from within it — but I did not fetch B and C directly with @Query: @Query var a: [A] var body: some View { ForEach(a) { item in item.B item.C } } After reading your explanation, I changed my code to fetch B and C directly using @Query, and then filtered them to include only those related to the specific A instance: @Query var a: [A] @Query var b: [B] @Query var c: [C] var body: some View { ForEach(a) { item in b.filter{$0.a == item} c.filter{$0.a == item} } } Now, when the widget updates a B or C object, the corresponding view in the app does update as expected — so your explanation about remote changes and @Query behavior was exactly what I needed. Thanks again!
Jul ’25