With ARC, every pointer assignment does a retain by default. In that light, in noatomic cases, why do I even need to declare properties?
How are these two any different?
//Property
@interface I1 : NSObject
@property (nonatomic, strong) NSString* str;
@end
I1 *obj1 = ...;
obj1.str = [[NSString alloc] init...];
//Only member variable
@interface I2 : NSObject {
@public
NSString* str;
}
@end
I2 *obj2 = ...;
obj2->str = [[NSString alloc] init...];
Memory management is not the only advantage of using properties.
Two in particular that come to mind for me is:
willChangeValueForKey:anddidChangeValueForKey:– see Manual Change Notification)bbum wrote a great response to this in iOS: must every iVar really be property?