Group Group Group Group Group Group Group Group Group

Chapter 5 Explicit cast can fail

In the function updateARPlaneNode()

The line:
let planeGeometry = planeNode.geometry as! SCNPlane

appears to fail consistently after a few seconds of execution

Changing it to
guard let planeGeometry = planeNode.geometry as? SCNPlane else { return }

is perhaps safer?

@mratliff Does the second version work better in this case?

It doesn’t seem to fail anymore and I can’t see any downside to the approach, but I have not worked on into later chapters as of yet.