(if I understood fine your question):

because ObjC uses informal protocols to define delegates, and an informal 
protocol might or might not be complete (it just define a collection of methods 
that you might have). 
is informal because user could want to define just a part of the protocol (in 
the example, just windowShouldClose:) and not the many objects the delegate 
protocol defines. 
and it is not an abstract class with empty methods because then you force user 
to extend a particular class (and you cannot not use any arbitrary object as a 
delegate)

Esteban

ps: is possible that Cocoa uses delegates and we can use just blocks… I don’t 
know… but the delegating idea is to not pollute apps with thousands of 
subclasses of widgets with minimal variations (like something we know) :)

On 16 Jul 2014, at 10:48, stepharo <[email protected]> wrote:

> Hi
> 
> In the quest for a better UI framework :), I was re rereading about delegate 
> in Cocoa.
> A delegating object will delegate certain operations to a delegate object 
> (check the attachment).
> Now I was wondering why this is not a simple delegation they wrote:
> 
> The delegating object sends a message only if the delegate implements the 
> method. It makes this discovery by invoking the NSObject method 
> respondsToSelector: in the delegate first.
> 
> 
> 
> <Screen Shot 2014-07-16 at 10.47.04.pdf>

Reply via email to