Summary

In this chapter, we looked at the new error-handling features and availability attribute that were added in Swift 2. These two features can help us write safer code and make our applications more stable.

The error-handling feature of Swift 2 significantly changes the way Swift programmers handle errors. While we are not required to use this new feature in our custom types, it does give us a uniform manner to handle and respond to error. Apple has also started to use this error handling in the Cocoa and Cocoa Touch frameworks.

The new availability attribute allows us to develop applications that take advantage of the latest features of our target operating systems while still allowing our applications to run on older versions.

In the next ...

Get Swift: Developing iOS Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.