title: touchesBegan Vs UITapGestureRecognizer
body: <p>So I'm making a spritekit game using swift. And I was wondering which is best to use gesture wise?</p>
  
  <p>Currently I have a <code>override func touchesBegan</code> handling all taps and a <code>UILongPressGestureRecognizer</code> handling long taps/holds.</p>
  
  <p>So you know, a tap presses buttons and jumps the hero. The long hold makes the hero duck.</p>
  
  <p>For some reason my longPress function isn't always called (sometimes you can press and hold 10 times and then it stops being called (isn't recognised), other times it's 5, it varies), and this led to a whole day yesterday trying new things and investigating, which brought me to this question.</p>
  
  <p>Is it better to use <code>touchesBegan</code> or move all my touch calls to a new function handled by a <code>UITapGestureRecognizer</code>?</p>
  
  <p>I did move everything from <code>touchesBegan</code> to <code>UITapGestureRecognizer</code> but it seems very sluggish. But I may have been implementing it wrong?</p>
  
  <p>This is how the <code>recognisers</code> are set up:</p>
  
  <pre><code>func setupRecognizers() {
      let tapRecognizer = UITapGestureRecognizer(target: self, action: Selector("handleTap:"))
      view!.addGestureRecognizer(tapRecognizer)
  
      let longTapRecognizer = UILongPressGestureRecognizer(target: self, action: Selector("handleLongPress:"))
      longTapRecognizer.minimumPressDuration = 0.2
      view!.addGestureRecognizer(longTapRecognizer)
  
  }
  </code></pre>
  
  <p>These are the functions that handle the gestures:</p>
  
  <pre><code>func handleTap(recognizer: UIGestureRecognizer) {
      //currently all handled in touchesBegan
  }
  
  func handleLongPress(recognizer: UIGestureRecognizer) {
      print("1 --------&gt; longPress Called.... ", recognizer.state.rawValue, gameState)
      if gameState == .Play {
         //do stuff
         //duck Hero
      } else {
         //switch gameState
      }
  }
  </code></pre>
  
  <p>This is the function that handles the touches/taps:</p>
  
  <pre><code>override func touchesBegan(touches: Set&lt;UITouch&gt;, withEvent event: UIEvent?) {
     /* Called when a touch begins */
  
  for touch in touches {
       let location = touch.locationInNode(self)
  
       //do stuff
  
       switch gameState {
          case .MainMenu:
          break
          ... //more states
          }
     }
     super.touchesBegan(touches, withEvent: event)
  }
  </code></pre>
  
  <p>If I move everything from <code>touchesBegans</code> to a <code>tapRecogniser</code> (the empty function above), I have to implement this too, to convert the touch location coordinates:</p>
  
  <pre><code>func handleTap(recognizer: UIGestureRecognizer) {
      let location = convertPointFromView(CGPoint(x: recognizer.locationInView(nil).x, y: recognizer.locationInView(nil).y))
      print("Converted Coords: ", location)
  
      //then do all touchesBegan stuff
   }
  </code></pre>
  
  <p>I've tried both, but the latter seems realllllly slow and sluggish. Maybe I'm forgetting to implement something that is recommended?</p>
  
  <p>Seems my longPress gesture doesn't always get called, could there be some conflict between these?</p>