Skip to main content

SyncKit for Realm


Your model classes must have a primary key.

How to use#

import SyncKit
synchronizer = CloudKitSynchronizer.privateSynchronizer(containerName: "your-container-name", configuration: realmConfiguration)
// Synchronizesynchronizer.synchronize { error in            ...}

In its Realm version SyncKit uses a Realm model internally to keep track of changes in your model. Depending on how you integrate SyncKit with your project you might want to specify the classes that your Realm manages to avoid it from picking up internal classes from SyncKit:

let configuration = RLMRealmConfiguration()configuration.objectClasses = [MyClass1.self, MyClass2.self, ...]let realm = try! RLMRealm(configuration: configuration)


CloudKit doesn't support ordered relations or many-to-many relationships, so SyncKit will ignore your RLMArray/Array properties. It is recommended to model your many-to-one relationships using RLMLinkingObjects/LinkingObjects and Object properties.