Skip to content

Instantly share code, notes, and snippets.

@GregularExpressions
Created November 21, 2014 16:24
Show Gist options
  • Save GregularExpressions/2af43a15cc4aafb3f8f4 to your computer and use it in GitHub Desktop.
Save GregularExpressions/2af43a15cc4aafb3f8f4 to your computer and use it in GitHub Desktop.
moveManagedObjects:ToContext:
- (NSArray*) moveManagedObjects:(NSArray*)managedObjects toContext:(NSManagedObjectContext*)newContext
{
NSMutableArray* movedManagedObjects = [NSMutableArray array];
for (NSManagedObject* managedObject in managedObjects) {
NSManagedObject* newManagedObject = [newContext objectWithID:managedObject.objectID];
[movedManagedObjects addObject:newManagedObject];
}
return movedManagedObjects;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment