Hi,
I want to know how to create an object to an interface ie @protocol in Objective-C?
Hi,
I want to know how to create an object to an interface ie @protocol in Objective-C?
It is not very clear what do you want to get.
If you want to define a class that conforms to a protocol you write:
@interface MyClass: ParentClass <MyProtocol1, MyProtocol2,...>
If you want to define an object that must be an instance of some class that confirms to a protocol you can write:
id<MyProtocol> myObject;
If you want to obtain Protocol object by name you can use
Protocol *objc_getProtocol(const char *name)
function. I don't know if you can create Protocol in run-time though.