OK – newbie Objective-C question:
When declaring properties there are attributes such as below:
@property (weak, nonatomic)
I realize I need read up on this to fully understand it but most of what I found was reference material, so a link to a good article that could explain best practices / usage scenarios (when to use which attribute for primitives, reference types, outlets, etc) or a couple of examples would be appreciated.
Thanks!
From a recent class I gave on this (inspired by Paul Hegarty)
nonatomic – NOT thread safe see link Justin pointed out in the comments above.
strong (or retain) – keep this object allocated until I don’t point to it anymore (set it to nil). Compiler will also throw this out of the heap (deallocate it) if I am not pointed to strongly anymore (I get dealloc’d)
weak – keep this object allocated as long as something still points to it strongly. IBOutlets are usually declared as weak since they will be retained automatically by the view controller.
Primitive types are not allocated on the heap and don’t use strong or weak