Objective-c – ARC properties’ new attributes

automatic-ref-countingios5objective c

I've read the transitioning to ARC notes and I still have a bit of confusion about properties' attributes we shoul/can use… We can use weak in place of assign (with the advantage that the property is set to nil if the object it points to is released), strong in place of retain and what in place of copy? We still use copy alone or do we need to couple strong with copy, such as property (strong,copy).. Maybe I need to practice and read again the doc because ARC is not very clear to me…

Best Answer

The Clang ARC documentation has this to say:

copy implies __strong ownership, as well as the usual behavior of copy semantics on the setter.

Regarding custom setter methods, it has this to say:

A property's specified ownership is preserved in its metadata, but otherwise the meaning is purely conventional unless the property is synthesized.

So if you implement custom setters, you're responsible for implementing strong or weak semantics in those setters.