Skip to main content

CoreDataAdapterRecordProcessing

An implementation of this protocol can be provided for custom CKRecord generation.

@objc public protocol CoreDataAdapterRecordProcessing: AnyObject 

Inheritance#

AnyObject

Requirements#

shouldProcessPropertyBeforeUpload(propertyName:​object:​record:​)#

Called by the adapter before copying a property from the Core Data object to the CloudKit record to upload to CloudKit. The method can then apply custom logic to encode the property in the record.

func shouldProcessPropertyBeforeUpload(propertyName: String, object: NSManagedObject, record: CKRecord) -> Bool

Parameters#

  • propertyName: The name of the property that is being processed
  • object: The NSManagedObject that is going to have its record uploaded.
  • record: The CKRecord that is being configured before being sent to CloudKit.

shouldProcessPropertyInDownload(propertyName:​object:​record:​)#

Called by the adapter before copying a property from the CloudKit record that was just downloaded to the Core Data object. The method can apply custom logic to save the property from the record to the object. An object implementing this method should not change the record itself.

func shouldProcessPropertyInDownload(propertyName: String, object: NSManagedObject, record: CKRecord) -> Bool

Parameters#

  • propertyName: The name of the property that is being processed
  • object: The NSManagedObject that corresponds to the downloaded record.
  • record: The CKRecord that was downloaded from CloudKit.