I have a SwiftData application that is using CloudKit. If user is on new device. How can I check and fetch data, instead of just waiting for it happen on its own randomly?
For example, I have onboarding which I do not want user to go through again if they already have an active installation.
Seems like SwiftData is severely limited in pretty much every way, specially any useful CloudKit debugging or control functionality.
As of today, SwiftData + CloudKit is based on NSPersistentCloudKitContainer
, and there is no API for apps to configure the timing for the synchronization. To observe the synchronization activities, you can use NSPersistentCloudKitContainer.Event.
The following technotes provides the whole picture of how NSPersistentCloudKitContainer
works:
-
TN3164: Debugging the synchronization of NSPersistentCloudKitContainer.
-
TN3163: Understanding the synchronization of NSPersistentCloudKitContainer.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.