A concrete example of the « guard » statement in Swift 2

Background

A lot of my recent project involve functions with completion handlers returning either an error, or an (optional) object. That's the case for most of CloudKit functions. Example: [crayon-6515959c6d9c5343674985/] Or MapKit : [crayon-6515959c6d9d1418632798/] I'm still learning the new error handling in Swift 2, so I don't know if these completionHandlers returning NSError? still have a future. What I know is that the guard statement is quite helpful in this case. (suite…)

Tagged , Read More