At the beginning of the process of learning OC, has been the declaration after the return value of the attribute characteristics do not understand what meaning, today specially found a bit of information, thoroughly understand the meaning of it.
The attribute features in OC mainly include Assign,copy,retain, the three main, and the Readonly,readwrite. In addition, Atomic and nonatomic; and Strong,weak.
Assign is primarily a simple assignment for the underlying type data and the C data type, and it does not call the index counter (retain count).
Retain primarily refers to the invocation of objects in OC, the assignment of objects in OC (primarily for NSObject and its subclasses), the need to call the index counter (retain count) for +1 operations, open up new memory space, and release operations after the new values are assigned.
Copy refers to the use of a copy of the object, the count of the index counter remains at 1, it just creates a new pointer for the object, pointing to the object at the corresponding location in memory, and does not open up new memory space (at this point, replication is shallow copy).
ReadOnly is to generate only getter methods, not setter methods, which are read-only storage.
ReadWrite is the default property and will generate getter and setter methods with no additional parameters.
Assign is an atomic access, and if more than one thread calls the setter method, it does not appear before one thread calls the setter to finish, and another thread starts calling the setter, which can be said to lock the property.
Nonassign non-atomic access, no synchronization and multithreading, no locking, when there are multiple threads, there will be problems, but this relatively improved performance.
Attribute characteristics in OC