The syntax for creating a protocol that implements another protocol is as such:
@protocol NewProtocol <OldProtocol>
- (void)foo;
@end
If you want to call a method in NewProtocol
on a pointer typed as OldProtocol
you can either call respondsToSelector
:
if ([object respondsToSelector:@selector(foo)])
[(id)object foo];
Or define stub methods as a category on NSObject
:
@interface NSObject (NewProtocol)
- (void)foo;
@end
@implementation NSObject (NewProtocol)
- (void)foo
{
}
@end