Chapter 6. Formalizing with Protocols and Extensions

Congratulations on completing a set of milestone topics in the last chapter: classes, structures, and enumerations—your Swift journey through this book is almost halfway finished! Yet you’ve only scratched the surface of what Swift’s object-oriented capabilities are. There’s still plenty to explore in this area, and for now, our focus will remain on concepts related to classes and structures.

Two significant features of the Swift language expand the utility and flexibility of classes and structures: protocols and extensions. That material will carry us through this chapter.

Following Protocol

Dinner fork versus salad fork. Saying “please” and “yes, sir” or “yes, ma’am.” These are behavior ...

Get Swift for Beginners: Develop and Design, Second Edition 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.