So I\'m trying to wrap my head around Objctive-C interfaces, delegates and protocols. So I have a question:
Does a delegate have to be in a separate file or can it
A delegate protocol needs to be defined as such
@protocol
//methods
@end
it can be put in any .h class, you just need to import i t whenever you are going to use it.
A protocol is not like a java interface, a protocol is an adapter that allows two classes to works together. Basically it says, if you want class A to send you messages about its state and actions these are the methods it will call on its delegate that you must implement. Its not like an interface because an interface says if you want to subclass this class you must implement these methods, the protocol says if you want to interact with this class you must implement these methods, so its somewhat different.