Last active
January 27, 2017 22:00
-
-
Save roymckenzie/f3e0c96f6293db2eff10f6a0b982993d to your computer and use it in GitHub Desktop.
Protocol for Realm Objects that I want to sync with CloudKit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol CloudKitSyncable { | |
var id: String { get } | |
var recordID: CKRecordID { get } | |
var synced: Date? { get } | |
var modified: Date { get } | |
var deleted: Date? { get } | |
var record: CKRecord { get } | |
var recordChangeTag: String? { get } | |
var recordOwnerName: String? { get } | |
} | |
final class RealmObject: Object { | |
// All your object specific properties | |
// | |
// CloudKitSyncable | |
dynamic var id: String = UUID().uuidString | |
dynamic var synced: Date? = nil | |
dynamic var modified: Date = Date() | |
dynamic var deleted: Date? = nil | |
dynamic var recordChangeTag: String? = nil | |
dynamic var recordOwnerName: String? = CKOwnerDefaultName | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment