How to wait until cloud kit data is being synced with core data in swift in iOS13 How to wait until cloud kit data is being synced with core data in swift in iOS13 swift swift

How to wait until cloud kit data is being synced with core data in swift in iOS13


There is no API exposed to get the completion handler on sync of all CKRecord's to NSManagedObject's.

Also the update is working using a background silent notification so we can expect any change anytime. So its good to not having completion handler

What's next

You can create one attribute to check the sync time, just like a date when last sync happened to local record and check the lastModificationDate (By default CKRecord has this property) of the same record in iCloud.

So everytime when you launch the app check for all the records manually if any update is required, then wait for notification of update and keep on checking the sync status

Note: Be careful this may lead to delay your launch process if from any other device user is very active and new records are getting inserted or modified.


Currently, there is no API provided for iCloud sync completion. What you can do is