O'Reilly logo

Objective-C Quick Syntax Reference by Matthew Campbell

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 23

image

Protocols

Protocols Overview

Protocols are used to define a set of methods and properties independently of a class. Any class can adopt a protocol, which means that the class implements the properties and methods defined by the protocol. In effect, protocols define a contract that classes can agree to fulfill. When a class adopts a protocol, you can be confident that the class will have implemented the properties and methods in the protocol.

Defining Protocols

To use protocols, you must start by defining the protocol. Use the @protocol keyword to start defining the protocol. You can simply include this in the same file as the class ...

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