O'Reilly logo

Learn Swift 2 on the Mac, Second Edition by Waqar Malik

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

Chapter    17

Protocols

In the real world, people on official business are often required to follow strict procedures when dealing with certain situations. Law enforcement officials, for example, are required to “follow protocol” when making inquiries or collecting evidence.

In the world of object-oriented programming, it’s important to be able to define a set of behaviors that’s expected of an object in a given situation. As an example, a table view expects to be able to communicate with a data source object in order to find out what it’s required to display. This means the data source must be able to respond to the specific messages the table view might send.

Protocols define the interface—a blueprint of methods, properties, and other requirements ...

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