views:

33

answers:

2

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?

+1  A: 

You just need to create an instance of a class that implements the protocol.

Chuck
+3  A: 

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
bbum