Is there any way to do something like this (below doesn’t work):
@protocol ElementPicker <UIViewController>
- (id)initWithFile:(NSFileWrapper *)file andInfo:(NSString *)info;
@property (nonatomic, weak) NSObject<ElementPickerDelegate> *delegate;
@end
So that objects that implement “ElementPicker” must inherit from UIViewController?
No. Protocols can only extend other protocols. The closest you can do is define a variable, property, or parameter as being a
UIViewControllerthat also adheres to theElementPickerprotocol. Something like this:Side note – it is common to define delegates as
id, notNSObject. Such as: