Skip to content

Instantly share code, notes, and snippets.

@NZKoz
Created August 16, 2011 22:49
Show Gist options
  • Save NZKoz/1150383 to your computer and use it in GitHub Desktop.
Save NZKoz/1150383 to your computer and use it in GitHub Desktop.
Core Data API Weirdness
// constructor returns object which is useless till you do some other stuff
NSManagedObjectContext *context = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
// The context is 'initialized' but completely useless till this next line executes.
context.persistentStoreCoordinator = coordinator;
// returned object is immediately useful and API nicely encapsulated
NSManagedObjectContext *context = [coordinator newManagedObjectContextWithConcurrencyType:NSPrivateQueueConcurrencyType];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment