Blog Archives

flatMap vs compactMap

In Swift 4.1, the flatMap function was divided into two functions. One kept the same name: flatMap This method flattens a sequence. Let’s say we have a two-dimensional array: [sourcecode language=”javascript”] let a = [[0,1,2],[3,4,5]] [/sourcecode] We can use the

Tagged with: , ,
Posted in Swift

Higher order functions in Swift

More than just map, filter, reduce and sort…

Tagged with:
Posted in Swift