In Swift Programming Language, it says:
“all of the basic types in Swift—integers, floating-point numbers, Booleans, strings, arrays and dictio
Array is indeed a struct, a value type. However, they went into great lengths to make it behave like a reference type (special copy behaviour, subscripts can modify even constant arrays, they even defined ===
operator especially for arrays!).
This was probably done because of performance reasons but the resulting behavior is buggy and hard to work with.
To quote Apple (https://devforums.apple.com/thread/228695)
Array semantics were in flux at the time of Beta 1, and have been revised to provide full value semantics like Dictionary and String. This will be available in later betas.
-Chris
So, we can expect the Array behavior to change greatly in future betas.