Some classes, such as NSSpeechSynthesizer, include delegate support. Unlike the protocol, a refusal to provide a delegate method does not cause an error: the class always provides a method, but instead calls yours if it exists.
For example, NSSpeechSynthesizer has a method
-(void) speechSynthesizer:(NSSpeechSynthesizer*)sender didFinishSpeaking:(BOOL)complete;
If you provide an identically declared method, in the Fred class it will be called instead of your own synthesizer method, if you previously did this in this class,
speech = [[NSSpeechSynthesizer alloc] initWithVoice:@"com.apple.speech.synthesis.voice.Albert"]; [speech setDelegate:self];
This will work, although the compiler will warn you if you have not declared yourself as a delegate
@interface Fred : NSObject <NSSpeechSynthesizerDelegate>, in that {
.,.
(This example is adapted from Cocoa Programming ... by Hillegass).
source share