Edit AllPages

A number of tools that makes dealing with Core Data objects easier in app-delegate-has-single-NSManagedObjectContext apps.

Docs inline with the code. Consider them public domain – EmanueleVulcano aka millenomi


#import <Cocoa/Cocoa.h>

@interface NSManagedObjectContext (L0CoreDataTools)

// Returns a default context. (The implementation here defaults to NSApp’s delegate’s // managedObjectContext, but you can change it and all other methods will pick it up // appropriately.)


@interface NSFetchRequest (L0CoreDataTools)

// Executes this fetch request in the default managed object context.


@interface NSEntityDescription (L0CoreDataTools)

// Returns an entity from the default managed object context.


// The following methods assume that you are using custom classes for your // entities. @interface NSManagedObject (L0CoreDataTools)

// Creates a new instance of this managed object with the entity returned // by +entity and inserts it in the default managed object context.

// Returns the entity attached to this class in the default managed object context. // By default, returns the entity whose name is equal to the class (for example, for // class AbcGizmo, it returns the entity named AbcGizmo).



#import “L0CoreDataTools.h”

@implementation NSManagedObjectContext (L0CoreDataTools)

// tweak me if not storing your managed object context there.


@implementation NSFetchRequest (L0CoreDataTools)


@implementation NSEntityDescription (L0CoreDataTools)


@implementation NSManagedObject (L0CoreDataTools)