What are Objective-C delegates?

Quora Feeds

Active Member
Colin Barrett

Without knowing exactly what part you're struggling with, here are a couple of alternate explanations of delegation:

Another name for delegation is the Hollywood pattern -- "don't call us, we'll call you". When its needed, the delegate is called up and is either told a piece of information or asked for information of its own. Perhaps with that explanation the purpose of delegation is a bit clearer: it allows one object to allow part of its behavior or configuration to be handled by another object.

Usually delegation is seen as an alternative to subclassing. The advantage over subclassing is that you can strictly define the interface available to clients -- as opposed to letting subclassers have free reign over the object's behavior.

See Questions On Quora

Continue reading...
 
Top