Cloud Kit Storage
CloudKit transport: one custom zone in the user's private database, one record per file, the bytes as a CKAsset. Unlike the iCloud Drive container there are no placeholder files: a save completes when Apple's server has the record, and a read is a network fetch with a definite outcome.
remoteIdis always null and sizes are always known.list fetches zone changes since the last checkpoint (checkpointPath, one atomic JSON file holding the change token together with the records it stands for) and never downloads assets.
readBytes and downloadFile serve from a local cache under cacheDirectory when the cached copy matches the record's change tag; prefetch fills that cache eight records per request, two requests in flight.
Pass environment as
"development"for debug builds and"production"otherwise: Xcode's debug builds talk to the Development container, and the two must never share a checkpoint on one device.
Entitlements: com.apple.developer.icloud-services = [CloudKit] and the container in com.apple.developer.icloud-container-identifiers. The BackupEntry record type and the zone are created automatically in the Development environment; deploy the schema to Production in the CloudKit console before a TestFlight build.
Constructors
Functions
Cheap. Never touches the network.
Downloads into toLocalPath, replacing it. Throws CloudError.NotFound when absent.
Stable per (device, cloud account) when the platform can tell, so a sync engine can detect an account switch. Null on Drive, where the engine keys identity off the marker file's id.