I've become used to inheriting SCNNode for my App and therefore adding extra variables/methods to the inherited class.
However, I've encountered a situation where I need to create a clone of the object (e.g., a copy where the geometry, materials etc. are references rather than a freshly instantiated object)
https://developer.apple.com/documentation/scenekit/scnnode/1408046-clone
However, cloning the inherited class does not, of course, clone the extra member variables in the inherited class. So I have attempted to override clone(), but i can't find an example of how this override is meant to be used in inherited classes?
However, I've encountered a situation where I need to create a clone of the object (e.g., a copy where the geometry, materials etc. are references rather than a freshly instantiated object)
https://developer.apple.com/documentation/scenekit/scnnode/1408046-clone
However, cloning the inherited class does not, of course, clone the extra member variables in the inherited class. So I have attempted to override clone(), but i can't find an example of how this override is meant to be used in inherited classes?
Code Block class MyNode : SCNNode { let url: URL let someStruct: MyStruct init?(url: url, someStruct: someStruct) { self.url = url self.someStruct = someStruct } override func clone() -> Self { /* No idea what I'm meant to do in here? How do I 'clone' url and someStruct members here? Not sure about the following code either. */ super.clone() return self } }