I am fascinated by the possibilities of beautiful code with protocol extensions. But I do not seem to grasp the real difference between class inheritance.
I know there are different ways to model something, like I could use composition instead of class inheritance.
But then I knew the features of class inheritance, was that the subclass could use the implementations of the superclass very easily. With protocol extensions I have this feature too, even for value types.
So the question is which features do class inheritance have, what protocol extensions do not; or when to use class inheritance instead of protocol extensions.
The only real benefit I found is that you can create superclass objects, which are no subclass and so you can ignore any implementation details of the subclass.
If A is the superclass of B. Then you can create A and do not have to care about anything from B.
With protocols you always have to use the adopting struct/class.
In some cases it makes sense to create a UIResponder and not a UIViewController, because you do not want that functionality and it is safer and easier to just use a class with less features.
With protocols and their extensions only, you have to choose one implementation, so to not write the same code twice there has to be multiple protocols, one for each hierarchy level of the corresponding class hierarchy.
If P2 adopts P1 and P1E is the extension to P1 and P2E is the extension of P2, then you have to create a struct/class that adopts P1 only to get a less capable version of a struct/class that adopts P2.