Functions

The following functions are available globally.

  • The default directory used to initialize a CoreDataModel. On tvOS, this is the caches directory. All other platforms use the document directory.

    Declaration

    Swift

    public func defaultDirectoryURL() -> URL
  • Attempts to 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 saveContext(_ context: NSManagedObjectContext, wait: Bool = true, completion: ((SaveResult) -> Void)? = nil)

    Parameters

    context

    The managed object context to save.

    wait

    If true (the default), saves synchronously. If false, saves asynchronously.

    completion

    The closure to be executed when the save operation completes.