Swift and UIKit have protocols at the core of their design. You might have noticed this when you were implementing custom UIViewController transitions, or when you worked on a table view or collection view. When you implement these features, you create objects that function as delegates for the transitions, table views, and collection views, and conform them to specific protocols. When you worked on view controller transitions in Chapter 4, Immersing Your Users with Animation, you also implemented an NSObject subclass that conformed to UIViewControllerAnimatedTransitioning.
It's possible for you to define and use your own protocols. Protocols are not confined to delegate behavior only. Defining a protocol is very similar to defining a class, struct, or enum. The main difference is that a protocol does not implement or store any values on its own...