Change in iOS 18 prevents SwiftData synchronization between main app and extension

I have a Live Activity with a button that updates a SwiftData model. This used to work in iOS 17, but not on iOS 18. The reason is that in iOS 17, when you run an AppIntent from a Live Activity, the perform() method would run in the main app's process, meaning it had access to the app's ModelContainer/ModelContext. However, in iOS 18, this is no longer the case, and the perform() method of an AppIntent now runs in the extension's process.

While I can still construct a new ModelContainer & ModelContext in the AppIntent's perform() method, the main app's container and context will not see these changes until the app is relaunched.

How can I make this work in iOS 18 now that an AppIntent executed from an extension runs in a different process from the main app?

This topic is being discussed in the following thread, and so I'd suggest that you follow up there:

I basically pointed to the Adopting SwiftData for a Core Data app sample, and would like to know if that helps.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Change in iOS 18 prevents SwiftData synchronization between main app and extension
 
 
Q