Instance Method

execute(_:with:)

Sends a request to all the persistent stores associated with the coordinator.

Declaration

func execute(_ request: NSPersistentStoreRequest, with context: NSManagedObjectContext) throws -> Any

Parameters

request

A fetch or save request.

context

The context against which request should be executed.

error

If an error occurs, upon return contains an NSError object that describes the problem.

Return Value

An array containing managed objects, managed object IDs, or dictionaries as appropriate for a fetch request; an empty array if request is a save request, or nil if an error occurred.

User defined requests return arrays of arrays, where a nested array is the result returned from a single store.

Discussion

See Also

Executing Fetch Requests

func perform(() -> Void)

Asynchronously performs the block on the coordinator's queue.

func performAndWait(() -> Void)

Synchronously performs the block on the coordinator's queue.