Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#import <Foundation/Foundation.h>
// clang -g -Weverything -framework Foundation -o count count.m
@interface CountTest : NSObject
- (NSUInteger) count; // notice not a @property
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment