Instance Property


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


var viewContext: NSManagedObjectContext { get }


This property contains a reference to the NSManagedObjectContext that is created and owned by the persistent container which is associated with the main queue of the application. This context is created automatically as part of the initialization of the persistent container.

This context is associated directly with the NSPersistentStoreCoordinator and is non-generational by default.

See Also

Accessing the Context(s)

func newBackgroundContext() -> NSManagedObjectContext

Creates a private managed object context.

func performBackgroundTask((NSManagedObjectContext) -> Void)

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

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