NSManagedObjectContext

extension NSManagedObjectContext
  • Describes a child managed object context.

    Declaration

    Swift

    public typealias ChildContext = NSManagedObjectContext
  • Describes the result type for saving a managed object context.

    Declaration

    Swift

    public typealias SaveResult = Result<NSManagedObjectContext, Error>
  • Attempts to asynchronously commit unsaved changes to registered objects in the context. This function is performed in a block on the context’s queue. If the context has no changes, then this function returns immediately and the completion block is not called.

    Declaration

    Swift

    public func saveAsync(completion: ((SaveResult) -> Void)? = nil)

    Parameters

    completion

    The closure to be executed when the save operation completes.

  • Attempts to synchronously commit unsaved changes to registered objects in the context. This function is performed in a block on the context’s queue. If the context has no changes, then this function returns immediately and the completion block is not called.

    Declaration

    Swift

    public func saveSync(completion: ((SaveResult) -> Void)? = nil)

    Parameters

    completion

    The closure to be executed when the save operation completes.