Skip to content

Instantly share code, notes, and snippets.

@serhatsezer
Created February 15, 2016 09:11
Show Gist options
  • Save serhatsezer/1c0caf4d9a8657376dd5 to your computer and use it in GitHub Desktop.
Save serhatsezer/1c0caf4d9a8657376dd5 to your computer and use it in GitHub Desktop.
mapping
// Interface file (.h)
@interface SampleModel
@property(nonatomic, strong) NSString *Title;
@property(nonatomic, strong) NSString *Description;
@end
// Implementation file (.m)
@interface SampleModel
@property(nonatomic, copy) NSString *customProperty; // Framework maps this property too
@end
@implementation SampleModel
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:[self mapping]];
}
+ (NSDictionary *)mapping {
return @
{@"tt":@"Title",
@"dsc":@"Description"}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment