Chapter 6. Protocol-Oriented Programming
This book is about protocol-oriented programming. When Apple announced Swift 2 at the World Wide Developers Conference (WWDC) in 2015, they also declared that Swift was the world's first protocol-oriented programming language. From its name, we may assume that protocol-oriented programming is all about the protocol; however, this would be a wrong assumption. Protocol-oriented programming is about so much more than just the protocol; it is actually a new way of not only writing applications, but also how we think about programming.
In this chapter, you will learn:
- What is protocol-oriented programming
- How we can use protocol composition
- How we can use protocol inheritance
- How protocol-oriented programming compares to object-oriented programming
In Chapter 5, Object-Oriented Programming, we saw how we could design vehicle types in an object-oriented way. In this chapter, we will design the same vehicle types in a protocol-oriented way and compare the two...