culture Why Apple? Warn This post is not intend to argue any programming language. Barely related, it would be human language. Before you continue to read, I should warn you first. The following context may require
development Throw inside a do block and catch it back in Swift? Yes Lazy forks, it's just simple topic, but I did the experiment for you: enum SomeError: Error { case notBig case veryBig } func someErrorFucntion() { do { throw SomeError.veryBig } catch { print(error.localizedDescription) } } someErrorFucntion() // And it
development Fewer "guard" more flatMap Swift's guard syntax is good, I admitted. But it's not always the best choice in some cases. Let's consider: something.callback() { someOther:SomeOther? in guard let someOther = someOther else { return } functionTakeSomeOther(someOther) } Indeed,
development Map Map Map better in Swift Map function is quite a convenience method that often used in functional(mainly) programming. In Swift, all collection types(Array,Dictionary,Set...) support map. It take a closure that take element type from
culture 書單紙 書讀唔多,只講最正: Programming: The Swift Programming Language 1,2,2.2 Objective-C Programming Language 2.0 Edition Seven Programming Language in Seven Week Think functional Functional Programming with Swift C程序設計 三十日自制操作系統 Code Code