[Reading Notes] iOS-attributes, Reading Notes ios-
Assign: simple assignment.
Retain: After a value is assigned, the new retain method and the release method of the old value are called.
Copy: copy the value first, and assign the copy value to the instance variable. This modifier is only applicable to the NSCopying protocol.
Weak: indicates that the value of this attribute will be a weak reference, and there is no relation between the reference and the referenced. If the system destroys the object referenced by a property, the property value will automatically change to nil. generally, if the parent object has a reference to a sub-object, the sub-object should not hold a reference to the parent object. Instead, the parent object should be referenced using a bypass.
On the contrary, attributes of the strong reference type indicate the relationship between the referenced object and the referenced object. From the perspective of memory usage, the description is that before the referenced object is recycled, the referenced object will not be recycled.
Nonatomic specifies that the accesser method is non-thread-safe, that is, multiple threads can simultaneously access this attribute. By default, the accessors and methods are thread-safe, even in multi-threaded environments. However, even if you want to ensure normal operation in a multi-threaded environment, the accessors are not necessarily thread-safe. If the accessors method is specified as non-thread-safe, the getter method can directly return the instance variable value, which is more efficient. It is particularly recommended for iPhone applications.
References: iOS programming guide