I think I understood the difference between (formal) Protocols and Categories. Now, if I got it right, informal protocols should be categories (usually defined on NSObject) which are used for certain purposes (maybe to give the chance to implement only a part of the methods listed in it, unlike formal protocols). I need to be sure about it:
could anyone confirm that an Informal Protocol just IS a Category (or explain the differences)?
Thank you.
I think I understood the difference between (formal) Protocols and Categories. Now, if I
Share
Category is an extension for class functionality – this is an implementation of some methods:
Formal protocol is something completely different. If you are familiar with some other object oriented language then it is like interface (in Java, C++, C# etc.).
Protocol may be attached to any class implementation like this:
According to the documentation, the informal protocols ARE categories of NSObject class (I’ve never used this approach):