Skip to main content

RealmSwiftAdapter

public class RealmSwiftAdapter: NSObject, ModelAdapter 

Inheritance#

ModelAdapter, NSObject

Initializers#

init(persistenceRealmConfiguration:targetRealmConfiguration:recordZoneID:)#

public init(persistenceRealmConfiguration: Realm.Configuration, targetRealmConfiguration: Realm.Configuration, recordZoneID: CKRecordZone.ID) 

Properties#

persistenceRealmConfiguration#

public let persistenceRealmConfiguration: Realm.Configuration

targetRealmConfiguration#

public let targetRealmConfiguration: Realm.Configuration

zoneID#

public let zoneID: CKRecordZone.ID

mergePolicy#

public var mergePolicy: MergePolicy = .server

delegate#

public weak var delegate: RealmSwiftAdapterDelegate?

recordProcessingDelegate#

public weak var recordProcessingDelegate: RealmSwiftAdapterRecordProcessing?

forceDataTypeInsteadOfAsset#

public var forceDataTypeInsteadOfAsset: Bool = false

hasChanges#

public private(set) var hasChanges = false

recordZoneID#

public var recordZoneID: CKRecordZone.ID 

serverChangeToken#

public var serverChangeToken: CKServerChangeToken? 

Methods#

defaultPersistenceConfiguration()#

static public func defaultPersistenceConfiguration() -> Realm.Configuration 

prepareToImport()#

public func prepareToImport() 

saveChanges(in:)#

public func saveChanges(in records: [CKRecord]) 

deleteRecords(with:)#

public func deleteRecords(with recordIDs: [CKRecord.ID]) 

persistImportedChanges(completion:)#

public func persistImportedChanges(completion: @escaping ((Error?) -> Void)) 

recordsToUpload(limit:)#

public func recordsToUpload(limit: Int) -> [CKRecord] 

didUpload(savedRecords:)#

public func didUpload(savedRecords: [CKRecord]) 

recordIDsMarkedForDeletion(limit:)#

public func recordIDsMarkedForDeletion(limit: Int) -> [CKRecord.ID] 

didDelete(recordIDs:)#

public func didDelete(recordIDs deletedRecordIDs: [CKRecord.ID]) 

hasRecordID(_:)#

public func hasRecordID(_ recordID: CKRecord.ID) -> Bool 

didFinishImport(with:)#

public func didFinishImport(with error: Error?) 

record(for:)#

public func record(for object: AnyObject) -> CKRecord? 

share(for:)#

public func share(for object: AnyObject) -> CKShare? 

save(share:for:)#

public func save(share: CKShare, for object: AnyObject) 

deleteShare(for:)#

public func deleteShare(for object: AnyObject) 

deleteChangeTracking()#

public func deleteChangeTracking() 

saveToken(_:)#

public func saveToken(_ token: CKServerChangeToken?) 

recordsToUpdateParentRelationshipsForRoot(_:)#

public func recordsToUpdateParentRelationshipsForRoot(_ object: AnyObject) -> [CKRecord] 

shareForRecordZone()#

@available(iOS 15.0, OSX 12, *)    public func shareForRecordZone() -> CKShare? 

saveShareForRecordZone(share:)#

Store CKShare for the record zone.

@available(iOS 15.0, OSX 12, *)    public func saveShareForRecordZone(share: CKShare) 

Parameters#

  • share: CKShare object to save.

deleteShareForRecordZone()#

Delete existing CKShare for adapter's record zone.

@available(iOS 15.0, OSX 12, *)    public func deleteShareForRecordZone()