Skip to content

Instantly share code, notes, and snippets.

@markd2
Created January 22, 2013 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markd2/4595129 to your computer and use it in GitHub Desktop.
Save markd2/4595129 to your computer and use it in GitHub Desktop.
#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