NSPersistentCloudKitContainer - mirror sync

My app uses a mirrored CoreData Store with NSPersistentCloudkitContainer. The user has the option to turn cloudKit sync on or off by device. The app responds by setting the description?.cloudKitContainerOptions = nil - but keeps historyTracking on by setting description?.setOption(true as NSNumber,forKey: NSPersistentHistoryTrackingKey)

The app is working fine this way with multiple devices and if the user re-enables sync on a particular device that was either disabled or offline everything syncs just fine on all devices.

I now want to prune History transactions and I intend to clear the history older than say 7 days only when I receive a NSPersistentStoreRemoteChangeNotificationPostOptionKey observation on transactions that are outside the app.

Does a device that was either offline or had sync disabled as per above then re-enabled or come back online upload its local changes first then download changes from the store?

I am concerned that if is not this way I will potentially have to keep all History transactions?

NSPersistentCloudKitContainer - mirror sync
 
 
Q