I am working on a complicated project in Swift.
Basically, my program will get a value of type GameObject.
Then, my program will render that GameObject.
However, sometimes, the render functions and other things need to be changed.
In the past, my program was actually able to initialize a subclass of GameObject, instead of initializing the GameObject itself to allow this type of expandability.
So my question is: How do I cast the GameObject to a subclass, like SkySphere. Note that my project will never get a value of type SkySphere. It will always get a simple, basic GameObject.
I am open to other solutions, like copying the values in GameObject to one of these subclasses, like SkySphere. Note that GameObject can have children, so these values would have to be copied as well.