Posts for Tag: swift

Swift Arrays - The Bugs, the Bad and the Ugly (and a best practice suggestion)

UPDATE 2: I've added a new post about the changes in Beta 3 (I like them)

UPDATE: Apple have indicated that the array behaviour in Swift is going to change - see this post

My previous post suggests an explanation for why the behaviour of Swift Arrays is as it currently (in the very first Swift release) is as it is. In this post I intend to explain the behaviours, show the problems and give examples. Many examples are based on those found in this thread on the Apple Developer forums. Feel free to add comments if I've missed any categories and I'll incorporate them if they form a different case.

The relevant part of the documentation covers most of the behaviour and apart from the issues specifically mentioned in the Bugs section at the bottom these are descriptions of the specification not just the implementation.

Is it Value? Is it Reference? No its Confused!