Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
This is a relatively long chapter. Now we understand how to use an Objective-C protocol to implement the Adapter pattern. Though the Delegation pattern itself can serve multiple intents other than just for the Adapter pattern, it was one of the major inspirations for the Adapter pattern in the first place! We have also explored how to take advantage of the power of Objective-C blocks to implement the Adapter pattern with a block serving as an adapter. Blocks are new to iOS development, but they are a powerful language feature. We should tap into them for more possibilities in the future.
The Adapter pattern is one of most commonly used design patterns. You can see it appear in code from time to time. The examples we used for illustrating the pattern are just a couple of them in the TouchPainter app. In real life, it's not uncommon to see design patterns used together for particular solutions, just like the examples of using an adapter with a command object. Try to check out a copy of the source code and see how many more adapters you can find in the app.