O'Reilly logo

Protocol-Oriented Programming with Swift by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Designing and developing with protocols

With protocol-oriented programming, we should always begin our design with the protocols, but how should we design these protocols? In the object-oriented programming world, we have super-classes that contain all of the base requirements for the sub-classes.

In the protocol-oriented programming world, we use protocols instead of super-classes and it is preferable to break our requirements into smaller, very specific protocols rather than having bigger monolithic protocols. In this section we will look at how we can separate our requirements into smaller, very specific protocols and then use protocol composition to add the requirements to our types.

In this section, we will be demonstrating how to define property ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required