In objective-C, attributes are usually set with the following keywords:
-- Assign: Specifies the setter method to use a simple value assignment, which is the default operation. You can use this attribute for scalar type (such as INT. You can imagine a float. It is not an object, so it cannot be retain or copy.
-- Retain: specifies that the retain should be called on a later object. The previous value sends a release message. You can imagine an nsstring instance, which is an object and you may want to retain it.
-- Copy: specifies that the object copy (deep copy) should be used. The previous value sends a release message. Basically like retain, but does not increase the reference count, it is to allocate a new memory to place it.
-- Readonly: only the getter method is generated instead of the setter method (the getter method does not have the get prefix ).
-- Readwrite: the default attribute. The getter and setter methods without additional parameters are generated (the setter method has only one parameter ).
-- Atomic: the default attribute of the object, that is, the method generated by setter/getter is an atomic operation. If multiple threads call setter at the same time, there will be no execution of Setter in another thread before executing all the setter statements. It is related to the locking at the beginning and end of the method.
-- Nonatomic: the atomicity of setter/getter is not guaranteed. data may be faulty in the case of multiple threads.