Handling multiple delegates in Objective-C is usually done using NSNotificationCenter, but here’s a library from Jacob Jennings that provides an easy to implement alternative with some message handling advantages.
Rather than the usual NSNotificationCenter approach this library uses NSProxy, takes a list of target delegates and implements its own message handling.
As the readme states here is how :
- Messages with a void return type are sent to all target delegates
- Messages with non-void return types are send to the first delegate in the list which responds to the selector.
You can find HTDelegateProxy on Github here with examples of how to use.
A very easy to use library that provides a great alternative to using NSNotificationCenter.
Original article: Library Providing An NSNotificationCenter Alternative For Handling Multiple Delegates
©2012 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.





