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?