Tuesday, 13 October 2015

What's new in Swift 2


  • Availability checking : – great for using if #available to run version-specific code in small blocks.
  • Error handling : try, catch, do and throw – it's been entirely rewritten to be modern, fast and safe, and unless you use only a small subset of the iOS APIs you're going to need to learn about it,
  • The guard keyword : early returns made easy – guard takes an if statement and adds extra optional unwrapping power, amongst other things.
  • The defer keyword : try/finally done right – if you return from a method at the end or middle, or if you exit a method by throwing an error, your deferred work will take place.
There's so much I haven't even touched on, But even though this little points is about some major new features  in Swift 2.