An informal protocol was, as Junnathan said, typically a category declared in NSObject without an appropriate implementation (most often it was a rare one that provided dummy implementations in NSObject).
Starting with 10.6 (and in the iPhone SDK), this template is no longer used. In particular, what was stated in 10.5 (and earlier) as follows:
@interface NSObject(NSApplicationNotifications) - (void)applicationWillFinishLaunching:(NSNotification *)notification; ... @interface NSObject(NSApplicationDelegate) - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; ...
Now declared as:
@protocol NSApplicationDelegate <NSObject> @optional - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; ... - (void)applicationWillFinishLaunching:(NSNotification *)notification; ...
That is, informal protocols are now declared as @protocol using the @optional set of methods.
In any case, the unofficial protocol is a collection of method declarations by which you can optionally use methods to change behavior. Typically, but not always, method implementations are provided in the context of delegation (a table view data source must implement several required methods and can, for example, implement some additional methods).
bbum Jan 6 2018-10-10T00: 00Z
source share