.map { $0 }
I feel like it should be possible to write as just:
.map()
or something
Or real world example:
let values = Dict<String: [Int]>(some data here).values.flatMap { $0 }
Yes you can actually use flatMap and pass value as the keypath:
let dict: [String: [Int]] = ["a": [1,2,3]] let values = dict.flatMap(.value) // [1, 2, 3]
1.4m articles
1.4m replys
5 comments
57.0k users