Nat! bio photo

Nat!

Senior Mull

Twitter Github Twitch

@protected or @public instance variables using @property

It's easy, but I didn't find it documented anywhere:


@interface Foo : NSObject
{
@public
   NSString  *_value;
}
@property(copy, nonatomic) NSString   *value;
@end

@implementation Foo
@synthesize value = _value;  // optional
@end

<sarcasm>Of course the standard way is preferable, because it's more like Java </sarcasm>