I'm trying to understand the best way to add multiple objects of different types to an [Any]
array. This doesn't work in a playground in Swift 3, unless I explicitly cast the arrays and the objects in the arrays to Any
.
var anyArray: [Any] = []
let strings = ["sup", "cool"]
let numbers = [5, 3]
anyArray += strings
anyArray += numbers
anyArray
It fails with the message - Cannot convert value of type '[Any]' to expected argument type 'inout _'