Created
January 24, 2012 14:22
-
-
Save jspahrsummers/1670404 to your computer and use it in GitHub Desktop.
Macro for safer key-value coding
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
#define ObjectKeyPath(OBJECT, KEYPATH) \ | |
((void)(NO && ((void)OBJECT.KEYPATH, NO)), @ # KEYPATH ) | |
NSString *str = @"foobar"; | |
NSLog(@"%@", [str valueForKey:ObjectKeyPath(str, length)]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment