Delegation

Delegation is one of the most common design patterns when working with Apple SDKs. Delegation is a pattern that facilitates the communication between two objects, the first one, which we'll call the source and the other, the delegate. The source can be anything from a view, such as UITableView / UITableViewDelegate, or a manager, such as CLLocationManager / CLLocationManagerDelegate.

In every case, the delegation pattern facilitates a many-to-one communication. A single delegate can handle as many sources as needed; however, a source can only have one and only one delegate.

Delegation should not be used if a single source object instance needs to communicate with different delegates. You will encounter race conditions or other issues.