TagForEach

Higher Order Function in Swift PART 2

H

Let’s start with FlatMap where few point need to cover. So lets begin, Flatmap Flatmap is used to flatten a collection of collections. let temp_Dictionary = [["k1":"v1","k2":"v2"],["k3":"v3","k4":"v4"]] let flatMap_1 = temp_Dictionary.flatMap { $0 } //[(key: "k2", value: "v2"), (key: "k1", value: "v1"), (key: "k3", value: "v3"), (key: "k4", value: "v4")] It returns an array of tuples after...

Category