During iOS development I'm using a lot of classes which come from proprietary code which I have no access to. I want to run custom code that should run when this class is instantiated into an object, but I don't know how to, as I can't really override their init without knowing what parameters said init takes.
For example I am working on a SceneDelegate
which subclasses UIResponder
and UIWindowSceneDelegate
and I want to have a property which should get initialized when the class is first instantiated, but I don't know how to.
At the moment I am just defaulting to defining the property as optional, initialize it in the method that will first use it, and write a whole bunch of code all around this class to handle the fact that it is unnecessarily optional.
Is there a better way?
Thanks!