I have shipped an app that utilizes Core Data in CloudKit viaNSPersistentCloudKitContainer
. I now want to add a widget that can query for the current data to display. It's my understanding you need to migrate this to a new location available to a shared App Group. How do you do this?
container = NSPersistentCloudKitContainer(name: "AppName")
container.loadPersistentStores { description, error in
//handle error
}
container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
container.viewContext.automaticallyMergesChangesFromParent = true