hi,
did you set NSPersistentHistoryTrackingKey and NSPersistentStoreRemoteChangeNotificationPostOptionKey, along with automaticallyMergesChangesFromParent and the mergePolicy? i use this code.
guard let persistentStoreDescriptions = container.persistentStoreDescriptions.first else {
fatalError("\(#function): Failed to retrieve a persistent store description.")
}
persistentStoreDescriptions.setOption(true as NSNumber,
forKey: NSPersistentHistoryTrackingKey)
persistentStoreDescriptions.setOption(true as NSNumber,
forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
container.loadPersistentStores(completionHandler: { (storeDescription, error) in ... })
container.viewContext.automaticallyMergesChangesFromParent = true
container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
there's also a recent article by Becky Hansmeyer (h ttps://beckyhansmeyer.com) that may be helpful.
hope that helps,
DMG
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: