A simple lib to sync CoreData to CloudKit
cloudkit = RCCloudKit(moc:context, identifier:@"iCloud.com....", zoneName:@"SomeZoneName")
sync = RCCloudKitSynchronizer(moc:context, ck:cloudkit)
cloudkit.didCreateZone = {
sync.start { containsChanges in
}
}
The CoreData entities must contain this fields:
- date: Date
- recordId: CKRecord
- recordName: String (Noticed bugs where the fetch from CoreData was not working with the recordId)
- markedForDeletion: Bool = false by default
If this does not satisfy you, you can create your own dataSource and delegate and use different logic.
CoreData objects are saved to CloudKit automatically after you save the main context. Aditionally you can start the sync manually after you are sure the zone was created.