-
strong
it's default option implicitly applied if no any other option of the same group is specified
means you have a reference to an object and you will keep that object alive. As long as you hold that reference to the object in that property, that object will not be deallocated and released back into memory. -
weak
gives you a reference so you can still “talk” to that object, but you are not keeping it alive. If everyone else’s strong references go away, then that object is released.
Less used:
-
assign
assign is the keyword used for primitives. It is pretty easy to understand: If you do not have an object, you cannot use strong, because strong tells the compiler how to work with pointers. But if you have a primitive (i.e. int, float, bool, or something without the little asterisk after the type), then you use assign, and that makes it work with primitives. -
copy
has been seen most commonly with strings. It works really well with all kinds of mutable objects. If you set a copy property, instead of just setting both references to the same object, what it actually does is it makes a copy of the object you are setting and then sets the property to that copy.
-
atomic
it's default option implicitly applied if no any other option of the same group is specified
Is guaranteed that if you try to read from it, you will get back a valid value. It does not make any guarantees about what that value might be, but you will get back good data, not just junk memory. -
nonatomic
Doesn't guarantee that you always get back something. If you try to read in the middle of a write, you could get back garbage data. But, on the other hand, you go a little bit faster.
If it is a property that you are accessing a lot, you may want to drop down to nonatomic to make sure that you are not incurring that speed penalty.
-
readwrite
it's default option implicitly applied if no any other option of the same group is specified
On the flip side, there is readwrite, which, of course, allows both read and write. That is the default; again, if you do not write anything, you have a readwrite property. -
readonly
makes it so this property is read-only. There is no setter for it at all. One caveat is that it cannot be readonly to everyone else, but readwrite to me: if you say readonly, it is read-only to everybody, including you.
The original content is taken from 'TMI #1: Objective-C Property Attributes'
Fri Jan 19 17:09:17 MSK 2018
https://academy.realm.io/posts/tmi-objective-c-property-attributes/