Create a gist now

Instantly share code, notes, and snippets.

@zoul /Foo.h
Created Jan 5, 2011

Embed
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

This comment has been minimized.

Show comment
Hide comment
@cameronehrlich

cameronehrlich Feb 17, 2017

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

@synthesize foo, bar;

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