Inherits from NSDocumentController
Declared in M2DocumentController.h
M2DocumentController.m

Overview

Adds shared context management functionality to document controller.

Tasks

Core Data stack

  •   persistentStoreCoordinator

    Returns the persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. (The directory for the store is created, if necessary.)

    property
  •   managedObjectModel

    Creates if necessary and returns the managed object model for the application.

    property
  •   managedObjectContext

    Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.)

    property
  • – saveShared

    Saves shared context

Helpers

  • – applicationFilesDirectory

    Returns the directory the application uses to store the Core Data store file. This code uses a directory named “Monsters2” in the user’s Library directory.

Properties

managedObjectContext

Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.)

@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext

Discussion

Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.)

Declared In

M2DocumentController.m

managedObjectModel

Creates if necessary and returns the managed object model for the application.

@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel

Discussion

Creates if necessary and returns the managed object model for the application.

Declared In

M2DocumentController.m

persistentStoreCoordinator

Returns the persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. (The directory for the store is created, if necessary.)

@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator

Discussion

Returns the persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. (The directory for the store is created, if necessary.)

Declared In

M2DocumentController.m

Instance Methods

applicationFilesDirectory

Returns the directory the application uses to store the Core Data store file. This code uses a directory named “Monsters2” in the user’s Library directory.

- (NSURL *)applicationFilesDirectory

Discussion

Returns the directory the application uses to store the Core Data store file. This code uses a directory named “Monsters2” in the user’s Library directory.

Declared In

M2DocumentController.m

saveShared

Saves shared context

- (void)saveShared

Discussion

Saves shared context

Declared In

M2DocumentController.h