NSApplicationDelegate and notification
Issue #34
In an iOS project, we often see this in AppDelegate
1 |
|
But in a Cocoa project, we see this instead
1 |
|
In this case the param is of type NSNotification
Delegate and notification
Reading Cocoa Core Competencies - Delegation
The delegate of most Cocoa framework classes is automatically registered as an observer of notifications posted by the delegating object. The delegate need only implement a notification method declared by the framework class to receive a particular notification message. Following the example above, a window object posts an NSWindowWillCloseNotification to observers but sends a windowShouldClose: message to its delegate.
So the pattern is that the delegate should strip the NS
and Notification
, like NSWindowWillCloseNotification
to windowShouldClose: