I have an NSMutabelArray with some objects in it as a property of my View-Controller.
Now I pass this array when I push this VC.
I initially made it assign.
but now I needed to modify the array whenever the device rotates, in the VC without affecting the one in previous VC.
so made it a copy property.
now I was individually changing the objects in the array.
but somehow..the array in my prev VC was also changing.
I had to create a new NSMutabelArray with modified objects and had to set to my property.
Is it that copy attribute just makes another array with same references of objects added to the array ?
The
copyattribute means the property will be assigned the object returned after sending thecopymessage to the object that was passed in. Whether that means deep or shallow depends on the object getting copied. The Foundation collections create shallow copies because that allowscopyto be implemented asretainfor immutable collections.