Confused about copying Arrays in Objective-C
- by Sheehan Alam
Lets say I have an array X that contains [A,B,C,D,nil];
and I have a second array Y that contains [E,F,G,H,I,J,nil];
If I execute the following:
//Append y to x
[x addObjectsFromArray:y];
//Empty y and copy x
[y removeAllObjects];
y = [x mutableCopy];
What is the value of y? is it?:
[A,B,C,D,E,F,G,H,I,J,nil]
Am I performing the copy correctly?