I'm trying to secure encode a SceneKit SCNMatrix4
so it conforms to NSSecureCoding
with something akin to the following:
if let transform = aDecoder.decodeObject(of: SCNMatrix4.self, forKey: DATA_KEY_TRANSFORM) {
self.transform = transform
}
But this throws-up the compile error:
Cannot convert value of type 'SCNMatrix4.Type' to expected argument type '[AnyClass]?' (aka 'Optional>')
Obviously SCNMatrix4
is not an object & is the reason why this doesn't work, but surely I don't need to go through every single one of the 16 Float
s in the SCNMatrix4
and encode each with:
aDecoder.decodeFloat(forKey: "someKey")
Surely not?
What is the correct way to secure encode this?