Using important Swift features
We've now covered the basics of Swift, in addition to the building blocks we need to create robust classes and organized data with structs and enums. With these tools, you'd be able to accomplish some great things, but there are a few other important features of Swift that can save you a lot of time, and help you squeeze out even more performance from your code. In this last section, we are going to introduce closures, protocols, class extensions, and Swift's error handling features.
Closures
We've already talked about functions, where we can take a chunk of code and turn it into a reusable command. However, in Swift there is another way to achieve that kind of functionality (no pun intended): closures. Using closures ...
Get Learning Xcode 8 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.