Declared in NSManagedObjectContext+MagicalRecord.h

Tasks

Class Methods

MR_context

+ (NSManagedObjectContext *)MR_context
Discussion

Creates and returns a new managed object context of type NSPrivateQueueConcurrencyType, with it’s parent context set to the root saving context.

Return Value

Private context with the parent set to the root saving context

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_contextWithParent:

+ (NSManagedObjectContext *)MR_contextWithParent:(NSManagedObjectContext *)parentContext
Discussion

Creates and returns a new managed object context of type NSPrivateQueueConcurrencyType, with it’s parent context set to the root saving context.

Parameters

parentContext

Context to set as the parent of the newly initialized context

Return Value

Private context with the parent set to the provided context

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_contextWithStoreCoordinator:

+ (NSManagedObjectContext *)MR_contextWithStoreCoordinator:(NSPersistentStoreCoordinator *)coordinator
Discussion

Creates and returns a new managed object context of type NSPrivateQueueConcurrencyType, with it’s persistent store coordinator set to the provided coordinator.

Parameters

coordinator

A persistent store coordinator

Return Value

Private context with it’s persistent store coordinator set to the provided coordinator

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_defaultContext

+ (NSManagedObjectContext *)MR_defaultContext
Discussion

Please do not use this context for saving changes, as it will block the main thread when doing so.

Return Value

Main queue context that can be observed for changes

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_initializeDefaultContextWithCoordinator:

+ (void)MR_initializeDefaultContextWithCoordinator:(NSPersistentStoreCoordinator *)coordinator
Discussion

Initializes MagicalRecord’s default contexts using the provided persistent store coordinator.

Parameters

coordinator

Persistent Store Coordinator

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_newMainQueueContext

+ (NSManagedObjectContext *)MR_newMainQueueContext
Discussion

Initializes a context of type NSMainQueueConcurrencyType.

Return Value

A context initialized using the NSPrivateQueueConcurrencyType concurrency type.

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_newPrivateQueueContext

+ (NSManagedObjectContext *)MR_newPrivateQueueContext
Discussion

Initializes a context of type NSPrivateQueueConcurrencyType.

Return Value

A context initialized using the NSPrivateQueueConcurrencyType concurrency type.

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_resetDefaultContext

+ (void)MR_resetDefaultContext
Discussion

Reset the default context.

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_rootSavingContext

+ (NSManagedObjectContext *)MR_rootSavingContext
Discussion

Root context responsible for sending changes to the main persistent store coordinator that will be saved to disk.

Use this context for making and saving changes. All saves will be merged into the context returned by MR_defaultContext as well.

Return Value

Private context used for saving changes to disk on a background thread

Declared In

NSManagedObjectContext+MagicalRecord.h

Instance Methods

MR_deleteObjects:

- (void)MR_deleteObjects:(id<NSFastEnumeration>)objects
Discussion

Delete the provided objects from the context

Parameters

objects

An object conforming to NSFastEnumeration, containing NSManagedObject instances

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_description

Description of this context

- (NSString *)MR_description

Return Value

Description of this context

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_parentChain

Description of the parent contexts of this context

- (NSString *)MR_parentChain

Return Value

Description of the parent contexts of this context

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_setWorkingName:

- (void)MR_setWorkingName:(NSString *)workingName
Discussion

Sets a working name for the context, which will be used in debug logs.

Parameters

workingName

Name for the context

Declared In

NSManagedObjectContext+MagicalRecord.h

MR_workingName

Working name for the context

- (NSString *)MR_workingName

Return Value

Working name for the context

Declared In

NSManagedObjectContext+MagicalRecord.h