Skip to content

Instantly share code, notes, and snippets.

@zoul
Created January 5, 2011 14:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoul/766381 to your computer and use it in GitHub Desktop.
Save zoul/766381 to your computer and use it in GitHub Desktop.
Synthesized properties in Objective-C without instance variables
@interface Foo : NSObject {}
@property(assign) float foo;
@end
#import "Foo.h"
// Private interface
@interface Foo ()
@property(assign) float bar;
@end
@implementation Foo
@synthesize foo, bar;
- (void) doSomething
{
foo = bar = 1;
}
@end
@cameronehrlich
Copy link

does this work if line 9 doesn't also include bar, like this?

@synthesize foo, bar;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment