O'Reilly logo

iOS 8 SDK Development, 2nd Edition by Janie Clayton, Chris Adamson

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 7Doing Two Things at Once with Closures

We started the last chapter with the example of a hypothetical household robot, who would answer the phone for us. We dealt with the problem of prank callers that never respond to “Hello” by batching together all of our instructions for how to handle the greeting until after the caller responds. That leaves the robot free to do other tasks in the meantime. Now let’s think about how that would work.

Some tasks will require the robot’s limbs, some need its eyesight, and others its voice and hearing. If we’re careful about how we divvy up tasks, the robot can do several things at once: we can prepare dinner while talking on the phone, and our robot should be able to as well.

So let’s imagine we have ...

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