Currently using beta 5 version of swift and There must have been a change to the +=
operator
func dealCards1() -> [Int] {
for i in 0...25{
comp1PlayDeck += shuffledDeck[i]
}
return comp1PlayDeck
}
this throws the '[(Int)]' is not identical to 'UInt8'
I am not quite sure what changes were made however It is quite confusing.
I suspect the error is the change in the +=
operator, it now only combines Array
s, not a value to an Array
.
shuffledDeck[i]
does not return an Array
. Creating an array of it's value is a work-around.
Examples:
comp1PlayDeck += [shuffledDeck[i]]
comp1PlayDeck.append(shuffledDeck[i])
From the Beta5 release documents:
"• The += operator on arrays only concatenates arrays, it does not append an element. This ! resolves ambiguity working with Any, AnyObject and related types. (17151420)!"