Created
February 6, 2012 02:33
-
-
Save pashields/1749048 to your computer and use it in GitHub Desktop.
A simple MapperConfig extension to load from a plist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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]; | |
[mappings each:^(id key, id obj) { | |
[[MapperConfig sharedInstance] mapPropertyName:key toOtherName:obj]; | |
}]; | |
} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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