I have such thing in my class definition:
NSObject<SomeProtocol> *dataDelegate;
I have custom -(id)init
method in which I should init this NSObject
. How do I do it if I want it to respond selectors from SomeProtocol
?
I have such thing in my class definition:
NSObject<SomeProtocol> *dataDelegate;
I have custom -(id)init
method in which I should init this NSObject
. How do I do it if I want it to respond selectors from SomeProtocol
?
You just need to create an instance of a class that implements the protocol.
If you have a class declared to implement SomeProtocol
, then you'd just do:
@interface SomeClass:NSObject <SomeProtocol>
.... etc ....
And in the implementation:
dataDelegate = [SomeClass new]; // or alloc/init