There are two types of object copy: shallow copy and deep copy. As the name implies, shallow copy, does not copy the object itself, only copies the pointer to the object; Deep copy is a direct copy of the entire object memory into another block of memory.

1 copy and mutableCopy of a non-collection object

Copy a pointer to an IMmutable object; copy a pointer to a mutableCopy object. Copy and mutableCopy are both content copies.

[immutableObject copy] // Shallow copy

[immutableObject mutableCopy] // Deep copy

[mutableObject copy] // Deep copy

[mutableObject mutableCopy] // Deep copy

Copy and mutableCopy of a collection object

Copy an immutable object, a pointer copy, and a content copy. Copy and mutableCopy are both content copies. However: copy of the content of a collection object is limited to the object itself; the object elements are still pointer copies. :

[immutableObject copy] // Shallow copy

[immutableObject mutableCopy] // Single layer deep copy

[mutableObject copy] // Single-layer deep copy

[mutableObject mutableCopy] // Single layer deep copy