How to keep the core data updated in app and extensions.

I'm using core data in app, widget extension and intent, but I found the data is not updated between targets. such as

  1. I added a new record in app, the widget is not updated unless remove the widget and re-add it.

  2. I added a new record in intent, the data in app is not updated unless I run the app again.

I have set container.viewContext.automaticallyMergesChangesFromParent = true but it doesn't work.

So how can I make the data is updated no matter it is modified any targets.

How to keep the core data updated in app and extensions.
 
 
Q