I’ve read that @synthesize will automatically create corresponding instance variables for @property and that ivars are @protected by default. But, what if I use a class extension (like below) to indicate that the @property methods are to be private?
// Photo.m
@interface Photo ()
@property (nonatomic, retain) NSMutableData *urlData;
@end
Will the corresponding ivar then be @private? Or should I explicitly declare it as @private like so?
// Photo.h
@interface Photo : Resource {
@private
NSMutableData *urlData;
}
@privateinstance variables are a compile-time-only feature. Given that the backing ivars for@property‘s are already hidden,@privatedoesn’t do anything. So in essence, it’s already@private.