Skip to main content

Architecture

Architecture

A QSCloudKitSynchronizer is configured with an identifier, a CloudKit container and a database (private or shared). It also may have a number of model adapter, each of those for a specific record zone.

The synchronizer asks its database for new changes, grouped by record zone, then it passes any downloaded CKRecord objects to the right model adapter, and the adapter takes care of translating the changes to actual model changes (Core Data or Realm). The model adapter also tracks local changes in the Core Data or Realm model layer so it can provide those changes in the form of CKRecords to be uploaded by the synchronizer.

If the synchronizer encounters changes in a record zone that it wasn't yet tracking it will ask its QSModelAdapterProvider for an adapter for that record zone, if available. In the default configuration, the private database synchronizer is configured with one model adapter for a record zone named QSCloudKitCustomZoneName and your provided model, but no adapter provider. The shared database synchronizer is configured with an adapter provider that will create new Core Data stacks (or Realms) for each new record zone that gets added to the shared database.