O'Reilly logo

Pro Objective-C Design Patterns for iOS by Carlo Chung

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 14. Iterator

Every time you buy a soda from a soda machine, you pop some coins in it, select the type of soda you want, and then it is delivered in the delivery tray.

Obviously, there is more than one bottle stored inside the soda machine. We consumers just won't know how those bottles are organized in the big tin box and how they are dispensed unless we crack the machine open to see what's inside. Otherwise, every time we buy a bottle of soda, we can only expect the machine to dispense the next bottle. The dispenser software running in the machine knows all the details about which bottle should next be dispensed among the whole collection of them available.

There are at least two main parts in a soda machine that do the job:

  • An internal ...

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