dannymout dannymout - 6 months ago 9
iOS Question

Initialize an array that will have multiple value types in Swift

How would I be able to initialize an array that will contain multiple value types.

Usually, I'd initialize it by typing this:

var array = [Int]()

Leo Leo
Answer

You can use Any

var array = [Any]();
array.append(1)
array.append("1")