Created
September 21, 2014 08:45
-
-
Save quellish/b9748cf4305e6fdcbe4a to your computer and use it in GitHub Desktop.
JSONPersonDataSource
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
| NSString * const JSONPersonFirstNameKeyPath = @"firstName"; | |
| NSString * const JSONPersonLastNameKeyPath = @"lastName"; | |
| @implementation JSONPersonDataSource | |
| - (instancetype) initWithJSON:(id)json { | |
| if ((self = [super init])){ | |
| jsonObject = json; | |
| } | |
| return self; | |
| } | |
| - (NSString *)firstName { | |
| [[self jsonObject] valueForKeyPath:JSONPersonFirstNameKeyPath]; | |
| } | |
| - (NSString *)lastName { | |
| return [[self jsonObject] valueForKeyPath:JSONPersonLastNameKeyPath]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment