O'Reilly logo

The Complete Idiot's Guide® To iPad and iPhone App Development by Troy Brant

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

Protocols

A protocol is a contract that declares a set of methods, which a class must implement. Protocols are equivalent to a Java interface (not to be confused with the Objective-C interface file). In this way, you can ensure that objects of various classes all respond to a particular message.
172
DEFINITION
A protocol defines a set of methods a class must implement. When a class adopts a protocol, it needs to provide a body for each method defined in the protocol or the Xcode compiler will produce a warning. Protocols are used to guarantee that objects of different classes respond to a particular message.

Required Versus Optional Methods ...

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