Skip to main content

CoreDataAdapterDelegate

An object implementing CoreDataAdapterDelegate is responsible for saving the target managed object context at the request of the QSCoreDataAdapter in order to persist any downloaded changes.

@objc public protocol CoreDataAdapterDelegate 

Requirements#

coreDataAdapter(_:​requestsContextSaveWithCompletion:​)#

Asks the delegate to save the target managed object context before attempting to merge downloaded changes.

func coreDataAdapter(_ adapter: CoreDataAdapter, requestsContextSaveWithCompletion completion: (Error?)->())

Parameters#

  • adapter: The CoreDataAdapter requesting the delegate to save.
  • completion: Block to be called once the managed object context has been saved.

coreDataAdapter(_:​didImportChanges:​completion:​)#

Tells the delegate to merge downloaded changes into the managed object context. First, the importContext must be saved by using performBlock. Then, the target managed object context must be saved to persist those changes and the completion block must be called to finalize the synchronization process.

func coreDataAdapter(_ adapter: CoreDataAdapter, didImportChanges importContext: NSManagedObjectContext, completion: (Error?)->())

Parameters#

  • adapter: The CoreDataAdapter that is providing the changes.
  • importContext: NSManagedObjectContext containing all downloaded changes. This context has the target context as its parent context.
  • completion: Block to be called once contexts have been saved.