i’m a little confused about these two qualifiers…
With ARC instead of using weak (i.e. if I need support iOS 4) I can use unsafe_unretained losing the auto-nil features… the final result seems to be similar to assign.
- Can I exchange
unsafe_unretainedwithassign? - Are these qualifiers the same thing ?
It would be really interesting any link of Apple documentation on this argument… I can find only a few rows here
Clang’s technical specification of ARC goes into much more detail about how the qualifiers work.
But, to answer your question:
assignand__unsafe_unretainedare not the same thing.assignis a property attribute that tells the compiler how to synthesise the property’s setter implementation, while__unsafe_unretainedis an ownership qualifier that tells ARC how to insertretain/releasecalls. But they are related: when declaring a property,assignimplies__unsafe_unretainedownership.Prior to ARC,
assignwas the default property ownership qualifier; but with ARC enabled, the default for retainable object pointer types isstrong. (For scalars and other pointer types,assignis still the default.)