I'm new to Objective C. I'm trying to use a protocol as I would an interface in Java, but I don't know how or even if it's the right tool for the job. I have defined a protocol in Protocol.h:
@protocol SomeProtocol
- (void)someMethod;
@end
Now, in another class, I need a variable that has someMethod
#import "Protocol.h"
@interface OtherClass:NSObject {
SomeProtocol objWithSomeMethod;
}
@end
Of course "SomeProtocol objWithSomeMethod" gives me an error. So is there a way to declare an object that, regardless of type, conforms to this protocol?