Skip to content

Instantly share code, notes, and snippets.

@rentzsch
Created July 17, 2009 03:26
Show Gist options
  • Save rentzsch/148842 to your computer and use it in GitHub Desktop.
Save rentzsch/148842 to your computer and use it in GitHub Desktop.
// As-is, this code results in a compiler warning:
// warning: property 'name' requires method '-name' to be defined - use @synthesize, @dynamic or provide a method implementation
// warning: property 'name' requires the method 'setName:' to be defined - use @synthesize, @dynamic or provide a method implementation
// Set NEEDS_DYNAMIC to 1 to silence the warning.
#import <Foundation/Foundation.h>
#define NEEDS_DYNAMIC 0
@interface MyClass : NSObject
@property (retain) NSString *name;
@end
@implementation MyClass
#if NEEDS_DYNAMIC
@dynamic name;
#endif
@end
int main (int argc, const char * argv[]) {
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment