O'Reilly logo

Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming by Erica Sadun, Rod Strougo, Maurice Sharp

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

Replacing a Protocol

Protocols enable one object to communicate with another, without either object knowing anything about the internals of the other. As you have seen, a protocol specifies a contract that the delegate implements the required methods conforming to the specification.

Like a protocol, a block is a contract. One object defines the return value and arguments. The other object writes a block matching the specification.

You have already done this in pulsing the taxi view. The animation call takes two defined blocks. One is a simple block with no arguments and no return value. The other takes one argument. AboutViewController implements the blocks as part of the method call, although you could just as easily define and write them elsewhere ...

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