Created
June 27, 2012 20:05
-
-
Save joshaber/3006514 to your computer and use it in GitHub Desktop.
This file contains 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
@interface MyClass : NSObject | |
@annotate(APIKey="object_id") | |
@property (nonatomic, strong) NSString *objectID; | |
@annotate(APIKey="full_name") | |
@property (nonatomic, strong) NSString *name; | |
@end | |
// The idea is that by associating metadata with those | |
// properties, I can automate parsing the JSON response | |
// from an API call into the object. | |
@implementation ... | |
- (void)parseAllTheThingsFromJSON:(NSDictionary *)JSONDictionary { | |
// mostly fake code: | |
NSDictionary *keyValuePairs = objc_getAnnotationsForProperty("objectID"); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment