Skip to content

Instantly share code, notes, and snippets.

@joericioppo
Created April 26, 2011 07:02
Show Gist options
  • Save joericioppo/941919 to your computer and use it in GitHub Desktop.
Save joericioppo/941919 to your computer and use it in GitHub Desktop.
@implementation NSArray (NSArray+MyAdditions)
- (NSArray *)arrayOfClass:(Class)class {
// oh look, dictionaries..
}
@implementation NSObject (NSObject+MyAdditions)
- (id)initWithDictionary:(NSDictionary *)dictionary {
self = [super init];
if (self == nil) {
return nil;
}
[self setValuesForKeysWithDictionary:dictionary];
return self;
}
@end
@implementation MyModelObject
- (void)setValuesForKeysWithDictionary:(NSDictionary *)keyedValues {
self.propertyName = [keyedValues valueForKey:@"underscore_bullshit"];
// etc..
}
// thanks @bmf!
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment