-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Mastering Swift 5.3
By :

Just like our object-oriented design, we will start off with a diagram that shows the types needed and the relationships between them. Figure 10.2 shows our protocol-oriented design:
Figure 10.2: Protocol-oriented design
As we can see, the POP design is quite different from the OOP design. In this design, we use three techniques that make POP significantly different from OOP. These techniques are protocol inheritance, protocol composition, and protocol extensions. We looked at protocol extensions in the previous chapter, but we have not covered protocol inheritance or composition yet. It is important to understand these concepts, so before we go into the design, let's look at what protocol inheritance and protocol composition are.
Protocol inheritance is where one protocol can inherit the requirements from one or more additional protocols. This is similar to class inheritance in OOP, but instead of inheriting...