Using this Stack Overflow question I have the following code.
let numbers = [1,[2,3]] as [Any]
var flattened = numbers.flatMap { $0 }
print(flattened) // [1, [2, 3]]
Instead of flattened being set to [1, [2, 3]]
I want it to be [1, 2, 3]
.
What is the easiest/cleanest way to achieve this in Swift?