Skip to content

Instantly share code, notes, and snippets.

@EverythingSolution
Created March 1, 2012 05:55
Show Gist options
  • Save EverythingSolution/1947672 to your computer and use it in GitHub Desktop.
Save EverythingSolution/1947672 to your computer and use it in GitHub Desktop.
- (void)copyAttributesFromObject:(NSManagedObject *)oldObject toObject:(NSManagedObject *)newObject
{
NSArray *attributeKeys = [[[oldObject entity] attributesByName] allKeys];
NSDictionary *attributes = [oldObject dictionaryWithValuesForKeys:attributeKeys];
[newObject setValuesForKeysWithDictionary:attributes];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment