Copy & mutablecopy Use the Copy or Mutablecopy method to create a copy of an object that you need to implement the Nscoppying protocol to create an immutable copy (such as NSString, Nsarray, Nsdictionary) Mutablecopy need to implement nsmutablecopying protocol to create a mutable copy (such as nsmutablestring, Nsmutablearray, Nsmutabledictionary) The purpose of copy is to make a copy, while modifying the original object and the replica does not interfere with each other deep copy: content copy, source object and copy point to different two object source object reference counter unchanged, copy counter set to 1 address value change shallow copy: pointer copy, The source object and the copy point to the reference counter of the same object object +1, which is actually equivalent to doing a retain operation address value does not change only the immutable object creates the immutable copy (copy) is the shallow copy, the other is the deep copy
Copy of iOS