Created
January 22, 2013 14:42
-
-
Save markd2/4595129 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
#import <Foundation/Foundation.h> | |
// clang -g -Weverything -framework Foundation -o count count.m | |
@interface CountTest : NSObject | |
- (NSUInteger) count; // notice not a @property | |
@end | |
@implementation CountTest | |
// no synthesize, no extra KVC work. | |
- (NSUInteger) count { | |
return 23; | |
} | |
@end // CountTest | |
int main (void) { | |
@autoreleasepool { | |
CountTest *countTest = [[CountTest alloc] init]; | |
NSNumber *count = [countTest valueForKey: @"count"]; | |
NSLog (@"count is %@", count); | |
} | |
return 0; | |
} // main | |
#if 0 | |
% clang -g -Weverything -framework Foundation -o count count.m | |
% ./count | |
2013-01-22 09:41:15.619 count[21737:303] count is 23 | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment