Skip to content

Instantly share code, notes, and snippets.

@slembcke
Created January 6, 2015 23:04
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 slembcke/df529e4c3df3bc38695b to your computer and use it in GitHub Desktop.
Save slembcke/df529e4c3df3bc38695b to your computer and use it in GitHub Desktop.
// in the .h file
@interface Foo : Bar {
@public
int _ivar1;
@protected
int _ivar2;
int _property2;
@private
int _ivar3;
}
// This will automatically declare a private "int _property1" ivar. (unless you implement both the getter and setter)
@property int property1;
// This property will use the use the _property2 ivar you declared above.
@property int property2;
@end
// in the .m file
@implementation Foo {
// You can put ivars in here too.
// They _can_ be public/protected, but there isn't much point unless you declare them in the header.
int _ivar4;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment