I'm using an almost identical CoreData stack as to what was shown in the WWDC 2019 Posts demo app. Here's the code: import Foundation import CoreData // MARK: - Core Data Stack /** The main Core Data stack setup including history processing./ class CoreDataStack { tt/** ttttA persistent container that can load cloud-backed and non-cloud stores. tt */ ttlazy var persistentContainer: NSPersistentCloudKitContainer = { tttt tttt// Create a container that can load CloudKit-based stores ttttlet container = NSPersistentCloudKitContainer(name: MyCoreDataApp) tttt tttt// Enable history tracking and remote notifications ttttguard let description = container.persistentStoreDescriptions.first else { ttttttfatalError(###(#function): Failed to retrieve a persistent store description.) tttt} ttttdescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) ttttdescription.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) tttt ttttcontainer.loadPer
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: