title: How to delete a specific node in an ARKit sceneView
body: <p>I have a lot of nodes in my scene view including the standard "focus square" (the node that helps the user place an object and that lays on the surface as the user moves the phone). I want to remove all of them except for that one.</p>
  
  <pre><code>class FocusSquare: SCNNode {
      // MARK: - Types
  
      enum State: Equatable {
          case initializing
          case detecting(hitTestResult: ARHitTestResult, camera: ARCamera?)
      }
  
      ...
      // Find code here: https://github.com/BlackMirrorz/ARKitWorldMaps/tree/c7ea837006e26ec7d8542ad2d3c417d5fd3910d5/CloudCube/CloudCube/Apple%20Focus%20Square
  }
  </code></pre>
  
  <p>This is how I remove all the nodes except for the focus square:</p>
  
  <pre><code>sceneView.scene.rootNode.enumerateChildNodes { (node, stop) in
      if let node = node as? FocusSquare {
          print("should not remove node") // fired once, however it still gets deleted
      } else {
          node.removeFromParentNode()
      }
  }
  </code></pre>
  
  <p>However, this does remove the focus square as well even though I am checking for the node class. Why can't I delete a specific node?</p>
  
  <p>I think the problem is that removing nodes here doesn't work like views. There's no "hierarchy" for how nodes are added in the scene view. I'm not sure though. This is how the focus square is added to the view:</p>
  
  <pre><code>public func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) {
      DispatchQueue.main.async { self.updateFocusSquare() }
  }
  
  func updateFocusSquare() {
      var screenCenter: CGPoint {
          let bounds = self.sceneView.bounds
          return CGPoint(x: bounds.midX, y: bounds.midY)
      }
  
      if let camera = self.augmentedRealitySession.currentFrame?.camera,
          case .normal = camera.trackingState,
          let result = self.sceneView.smartHitTest(screenCenter) {
          updateQueue.async {
              if self.canDisplayFocusSquare {
                  self.sceneView.scene.rootNode.addChildNode(self.focusSquare)
                  self.focusSquare.state = .detecting(hitTestResult: result, camera: camera)
              }
          }
  
      } else {
          updateQueue.async {
              if self.canDisplayFocusSquare {
                  self.focusSquare.state = .initializing
                  self.sceneView.pointOfView?.addChildNode(self.focusSquare)
              }
          }
      }
  }
  </code></pre>