title: Slider over ARSCNView in ARKit (Xcode)
body: <p>So I am new to Swift, Xcode and Arkit.
  I work with Xcode 9.2</p>
  
  <p>I wanted to build a simple app that places an object when tapped on the screen to the position it detected a plane or point.</p>
  
  <p>I Started up Xcode and wrote this short piece of code into the basic example thats there when u open up with scenekit.
  Code looks like this:</p>
  
  <pre><code>import UIKit
  import SceneKit
  import ARKit
  
  class ViewController: UIViewController, ARSCNViewDelegate {
      @IBOutlet var sceneView: ARSCNView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          // Set the view's delegate
          sceneView.delegate = self
  
          // Show statistics such as fps and timing information
          sceneView.showsStatistics = true
  
          // Create a new scene
          let scene = SCNScene(named: "art.scnassets/ship.scn")!
  
          // Set the scene to the view
          sceneView.scene = scene
      }
  
      override func viewWillAppear(_ animated: Bool) {
          super.viewWillAppear(animated)
  
          // Create a session configuration
          let configuration = ARWorldTrackingConfiguration()
  
          // Run the view's session
          sceneView.session.run(configuration)
      }
  
      override func viewWillDisappear(_ animated: Bool) {
          super.viewWillDisappear(animated)
  
          // Pause the view's session
          sceneView.session.pause()
      }
  
      override func touchesBegan(_ touches: Set&lt;UITouch&gt;, with event: UIEvent?) {
          guard let touch = touches.first else {return}
          let result = sceneView.hitTest(touch.location(in: sceneView), types: [ARHitTestResult.ResultType.featurePoint])
          guard let hitResult = result.last else {return}
          let hitTransform = SCNMatrix4.init(hitResult.worldTransform)
          let hitVector = SCNVector3Make(hitTransform.m41,hitTransform.m42,hitTransform.m43)
          createBall(position: hitVector)
      }
  
      func createBall(position: SCNVector3){
          var ballShape = SCNSphere(radius: 0.01)
          var ballNode = SCNNode(geometry: ballShape)
  
          ballNode.position = position
  
          sceneView.scene.rootNode.addChildNode(ballNode)
      }
  
      // MARK: - ARSCNViewDelegate
  
      func session(_ session: ARSession, didFailWithError error: Error) {
          // Present an error message to the user
      }
  
      func sessionWasInterrupted(_ session: ARSession) {
          // Inform the user that the session has been interrupted, for example, by presenting an overlay
      }
  
      func sessionInterruptionEnded(_ session: ARSession) {
          // Reset tracking and/or remove existing anchors if consistent tracking is required
      }
  }
  </code></pre>
  
  <p>I inserted this relevant part:</p>
  
  <pre><code>    override func touchesBegan(_ touches: Set&lt;UITouch&gt;, with event: UIEvent?) {
          guard let touch = touches.first else {return}
          let result = sceneView.hitTest(touch.location(in: sceneView), types: [ARHitTestResult.ResultType.featurePoint])
          guard let hitResult = result.last else {return}
          let hitTransform = SCNMatrix4.init(hitResult.worldTransform)
          let hitVector = SCNVector3Make(hitTransform.m41,hitTransform.m42,hitTransform.m43)
          createBall(position: hitVector)
      }
  
      func createBall(position: SCNVector3){
          var ballShape = SCNSphere(radius: 0.01)
          var ballNode = SCNNode(geometry: ballShape)
  
          ballNode.position = position
  
          sceneView.scene.rootNode.addChildNode(ballNode)
      }
  </code></pre>
  
  <p>This app runs fine. It places the ball everytime i tap on the screen.
  Now I wanted to Add a slider to the Main.Storyboard that changes the size value of the ball to be placed.
  Main.Storyboard looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/9sG9m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9sG9m.png" alt="enter image description here"></a></p>
  
  <p>When I drag the Slider on the Storyboard Screen, the slider is not added to the scene but it places instead of the ARSCNView to full scale. Then it looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/GGUba.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GGUba.png" alt="enter image description here"></a></p>
  
  <p>What do I have to do to just place the slider over the View? Does this Work with other UI Elements? Is this even possible and how does it work. It's probably simple but it's my first time coding in Xcode.</p>