Wednesday, 22 April 2015

is swift assigning an array to anther array value copy or reference copy?

As the explanation from below link, array copy is a reference copy, but if you change the it (change the size), the array will get a new copy:

For arrays, copying only takes place when you perform an action that has the potential to modify the length of the array. This includes appending, inserting, or removing items, or using a ranged subscript to replace a range of items in the array.

No comments:

Post a comment