There are circumstances where we do not have any other choice but subclassing. Here are some of examples of where subclassing is required:
- When it is required by the APIs: For instance, many Cocoa APIs require the use of classes and being controversial is not recommended. For instance, UIViewController has to be subclassed.
- When we need to manage and communicate our value types between instances of other classes: For example, when we need to draw a custom view in a Cocoa class provided by another drawing class, we will need to communicate it between them. Using a value type in this case is not beneficial.
- When we need to share an instance between multiple owners: Core data persistence is an example. It can be very useful ...