I was wondering if someone can explain what is informal protocols in Objective C? I try to understand it on apple documentation and some other books but my head is still spinning so i will really appreciate that if someone can explain with example.
Thanks.
An informal protocol was, as Jonnathan said, typically a category declared on NSObject with no corresponding implementation (most often — there was the rare one that did provide dummy implementations on NSObject).
As of 10.6 (and in the iPhone SDK), this pattern is no longer used. Specifically, what was declared as follows in 10.5 (and prior):
Is now declared as:
That is, informal protocols are now declared as
@protocols with a bunch of@optionalmethods.In any case, an informal protocol is a collection of method declarations whereby you can optionally implement the methods to change behavior. Typically, but not always, the method implementations are provided in the context of delegation (a table view’s data source must implement a handful of required methods and may optionally implement some additional methods, for example).