title: Drag and drop children of the same sprite
body: <p>I'm making a game using Sprite Kit and I want to be able to drag and drop boxes as they travel down the screen.</p>
  
  <p>Here's the gist of the code: I spawn the boxes on a timer and they move down the screen.</p>
  
  <pre><code>override func didMoveToView(view: SKView) {
      let timer = NSTimer.scheduledTimerWithTimeInterval(2.0, target: self, selector: Selector("spawnBox"), userInfo: nil, repeats: true)
  }
  func spawnBox() {
      /*        Set up the box        */
  
      addChild(box)
  
      let boxMoveDown = SKAction.moveToY(-100, duration: 5.0)
      let actionDone = SKAction.removeFromParent()
      box.runAction(SKAction.sequence([boxMoveDown, actionDone]))
  }
  </code></pre>
  
  <p>But the problem is I how can I move a <strong>specific</strong> child which I am touching without affecting all the other 'children'? I understand that at the moment, every time I spawn a box it's exactly the same so I can't be specific when I set a individual child's position.</p>
  
  <p>Here's what's inside my touchesBegan and touchesMoved functions</p>
  
  <pre><code>if let touch = touches.first {
      let location = touch.locationInNode(self)            
      let objects = nodesAtPoint(location) as [SKNode]
  
      if objects.contains(nodeAtPoint(location)) &amp;&amp; nodeAtPoint(location).name == "box" {
          box.position = location
          box.removeAllActions()
          }
      }
  </code></pre>
  
  <p>The - <code>box.position = location</code> is what 
  needs changing.</p>
  
  <p>Hopefully you understand my idea. I've tried to keep included code to what's necessary. I'm quite new to Sprite Kit which you can probably tell.</p>