Instance Method

newBackgroundContext()

Creates a private managed object context.

Declaration

func newBackgroundContext() -> NSManagedObjectContext

Return Value

A newly created private managed object context.

Discussion

Invoking this method causes the persistent container to create and return a new NSManagedObjectContext with the concurrencyType set to NSManagedObjectContextConcurrencyType.privateQueueConcurrencyType. This new context will be associated with the NSPersistentStoreCoordinator directly and is set to consume NSManagedObjectContextDidSave broadcasts automatically.

See Also

Accessing the Context(s)

func performBackgroundTask((NSManagedObjectContext) -> Void)

Causes the persistent container to execute the block against a new private queue context.

var viewContext: NSManagedObjectContext

The managed object context associated with the main queue. (read-only)

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software