-> T) rethrows -> [T] — arguments of map: closure that takes Element and return T — functions are like "named closures" — possible to pass function directly 7
example: convert Model to ViewModel ̴ model.map(ViewModel.init) — extracting logics as methods, as a result — feeling of passing function (different from imperative programming style) 15
Programming to Functions, Swift Talk2 2 https://talk.objc.io/episodes/S01E19-from-runtime-programming-to-functions 1 https://talk.objc.io/episodes/S01E05-connecting-view-controllers 16
{ return "a: \(a), b: \(b)" } // cannot pass tuples to function itself let parameters = (a: 0, b: 0) someFunc(parameters) // ! (swift3~) // can pass tuples when using map let array: [(Int, Int)] = [(0, 0)] array.map(someFunc) // " (even in swift3) — Please tell me if you know how this is possible 17