Created
January 5, 2011 14:24
-
-
Save zoul/766381 to your computer and use it in GitHub Desktop.
Synthesized properties in Objective-C without instance variables
This file contains hidden or 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
@interface Foo : NSObject {} | |
@property(assign) float foo; | |
@end |
This file contains hidden or 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 "Foo.h" | |
// Private interface | |
@interface Foo () | |
@property(assign) float bar; | |
@end | |
@implementation Foo | |
@synthesize foo, bar; | |
- (void) doSomething | |
{ | |
foo = bar = 1; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
does this work if line 9 doesn't also include
bar
, like this?