Skip to content

Instantly share code, notes, and snippets.

@pashields
Created February 15, 2012 17:51
Show Gist options
  • Save pashields/1837707 to your computer and use it in GitHub Desktop.
Save pashields/1837707 to your computer and use it in GitHub Desktop.
An example of loading ClassMapper keymappings from a plist file
#import "MapperConfig.h"
@interface MapperConfig (PListReader)
- (void)importFromPList:(NSString*)pListName;
@end
@implementation MapperConfig (PListReader)
- (void)importFromPList:(NSString*)pListName {
NSString *path = [[NSBundle mainBundle] pathForResource:pListName ofType:@"plist"];
NSDictionary *mappings = [[NSDictionary alloc] initWithContentsOfFile:path];
for (NSString *key in mappings) {
[[MapperConfig sharedInstance] mapPropertyName:key toOtherName:[mappings objectForKey:key]];
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment