Summary

This chapter has been a pretty rapid run through most of the Swift concepts and practices we will need throughout the rest of this book. It by no means covers all that Swift has to offer; that must be the subject of a book of its own. But understanding the material here will serve to make understanding the rest of the book much easier.

You have learned the following in this chapter:

  • How switch and guard can improve clarity, economy, and readability in our code
  • Making the most use of Swift functions, and how to use first class functions as objects
  • Making use of enumerations as data structures that can replace some classes
  • The use of protocols, and particularly their strengths as an alternative to class inheritance
  • How to override operators and create new ones
  • Handling the most common operators on collection types

The next chapter will take us into the Cocoa landscape, where we will begin to take a thorough look at how it works as a framework, and the programming concepts we will need to make the most effective use of its vast functionality.