According to the release notes for Xcode beta 3, you can now append a tuple to an array. Has anyone tried this? Unfortunately no example of using this was shown in the notes.
Append tuple to array?
var arr = [(Int, Int)]()
let aTuple = (3,4)
arr.append((1,2))
arr.append(aTuple)
In previous versions, only the second append would work without error.
Not-words* and append are for the birds.
var integerPairs = [(Int, Int)]()
let integerPair = (3, 4)
integerPairs += [(1, 2)]
integerPairs += [integerPair]
* Int is for the birds. var is for the birds. Please file radars about them.
OK got it I think. You can only append a tuple to an array of tuples AND the tuples have to have the same number of members.
Thanks
It will help you if you think of the tuple as an anonymous struct.
Thanks Jessy, I'll have to chew on that a little. Unfortunately I'm not a software engineer, just an old hacker from way back trying to learn swift. (By the way, 'hacker' had a different meaning back then!!)
I think the fact that you're here, and interested, puts you ahead of the vast majority of "engineers". I make software for a living now, but I got to that point by
- going to school for music/music tech
- not finding enough people making games, for whom I could make music and SFX, where I lived
- learning to makes games myself so I could make sound for them
- realizing that some types of programming are more fun and useful to the world that most of the games for which I could be making music