Skip to main content

RealmAdapter

@objc public class RealmAdapter: NSObject, ModelAdapter 

Inheritance#

ModelAdapter, NSObject

Initializers#

init(persistenceRealmConfiguration:targetRealmConfiguration:recordZoneID:)#

@objc public init(persistenceRealmConfiguration: RLMRealmConfiguration, targetRealmConfiguration: RLMRealmConfiguration, recordZoneID: CKRecordZone.ID) 

Properties#

persistenceRealmConfiguration#

@objc public let persistenceRealmConfiguration: RLMRealmConfiguration

targetRealmConfiguration#

@objc public let targetRealmConfiguration: RLMRealmConfiguration

zoneID#

@objc public let zoneID: CKRecordZone.ID

mergePolicy#

@objc public var mergePolicy: MergePolicy = .server

delegate#

@objc public var delegate: RealmAdapterDelegate?

recordProcessingDelegate#

@objc public weak var recordProcessingDelegate: RealmAdapterRecordProcessing?

forceDataTypeInsteadOfAsset#

@objc public var forceDataTypeInsteadOfAsset: Bool = false

hasChanges#

@objc public private(set) var hasChanges = false

recordZoneID#

public var recordZoneID: CKRecordZone.ID 

serverChangeToken#

public var serverChangeToken: CKServerChangeToken? 

Methods#

defaultPersistenceConfiguration()#

@objc static public func defaultPersistenceConfiguration() -> RLMRealmConfiguration 

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()