I am looking for a way to declare the implementation of delegate methods to be conditionally linked to each other. I am aware of the way of @required
and @optional
for mark specific methods. But I'd like to have a way to mark a method as required, if another is implemented. Is this possible?
What I like to do is something like this:
Think of the following delegate methods:
- (void) firstSuccessDelegateMethod;
- (void) firstErrorDelegateMethod;
- (void) secondSuccessDelegateMethod;
- (void) secondErrorDelegateMethod;
Is there a way to declare something like
if firstSuccessDelegateMethod
is implemented, firstErrorDelegateMethod
is required
if secondSuccessDelegateMethod
is implemented, secondErrorDelegateMethod
is required
Thanks!
Sadly this isn't possible, though you could always coalesce the two delegate methods into one, e.g.,