okay so I want to make a public function that will return YES if an object exists, conforms to a protocol and responds to a selector. I know the typedef of @selector is SEL but what is the typedef for @protocol
BOOL conforms(id object, ? prototype, SEL action) {
return (object != nil &&
[object conformsToProtocol:prototype] &&
[object respondsToSelector:action]);
}
And I want to be able to call this function like:
if(conforms(delegate, @protocol(UIScrollViewDelegate),
@selector(touchesBegan:withEvent:))) {
[delegate touchesBegan:touches withEvent:event];
}
You’re looking for the
Protocolobject: