I have a structure like [[[ ]]] which I want to convert to [].
[[[ ]]]
[]
E.g. [ [ [ \"Hi\" ] ] ] into [ \"Hi\" ]
[ [ [ \"Hi\" ] ] ]
[ \"Hi\" ]
How
Use reduce(_:_:) with your array this way.
let array = [[["One","Two","Three"],["Four","Five"]],[["Six"]]] let newArray = array.reduce([]) { $0 + $1.reduce([]){ $0 + $1 } } print(newArray) //["One", "Two", "Three", "Four", "Five", "Six"]