So the search around Stack Overflow seems to be how to make private variables in Objective-C:
@interface ClassName() { @private NSArray* private; } @property (strong, nonatomic) NSArray* public; @end
Now I'm embarrassed. A property is declared as (strong, nonatomic), but the private variable has nothing of the kind. So how does the arc know if it is strong or not?
(strong, nonatomic)
In the case of a property, ownership of the associated instance variable implies ownership of the property:
See http://clang.llvm.org/docs/AutomaticReferenceCounting.html :
, , , , , @synthesize. , ; .
, Objective-C :
, , __strong.
, LLVM 4.0 (Xcode 4.4) @synthesize , .
@synthesize
__strong.
__strong
Apple ARC ( ):
__ strong -
:
ARC -
, ivar @synthesize. . , -, , , , ivar.
@property ARC. , . , .
@property
A way to make it private (and strong) is to declare it strong in the category inside the .m file.
// .h // nothing // .m @interface ClassName() @property (strong, nonatomic) NSArray* myStrongPrivateProperty; @end // that it