Same protocol implementation in several classes

I have several classes (view controllers) that all follow the same protocol, and I would like them to implement exactly the same methods that this protocol requires.

I cannot create one base class with this implemented method and then force the inheriting controllers to inherit from this base class, because my view controllers all inherit from different classes anyway, and Objective-C does not allow multiple inheritance.

How to avoid inserting the same code (protocol method implementation) into multiple classes?

+3


source to share


1 answer


You can create a category in UIViewController that implements the protocol method.



+2


source







All Articles