Tag: guard
Choosing between guard statement and if let
Swift offers two important features for handling optionals: the guard statement and if let, also known as optional binding. What is guard? The guard statement is ideal for scenarios where you want to ensure certain conditions are met before proceeding with the execution of your code. If these conditions are not met, the guard statement…
What is new in Swift 2.0
Lots of new feature have been introduced as part of Swift 2.0. The list includes guard, repeat-while, defer, error handling, protocol extensions, print, pattern matching, early exits, UI Testing, UI Stackview etc. Let us see some of these cool features. guard, try and catch [code language=”swift”]func printISPDetails() { let url = NSURL(string: “http://www.telize.com/geoip”) let request…