title: Swift: Long Press Gesture Recognizer - Detect taps and Long Press
body: <p>I want to wire an action such that if the gesture is a tap, it does animates an object in a particular way but if the press duration was more than .5 secs it does something else.</p>
  
  <p>Right now, I just have the animation hooked up. I don't know how I can differentiate between a long press and a tap? 
  How do I access the press duration to achieve the above?</p>
  
  <pre><code> @IBAction func tapOrHold(sender: AnyObject) {
          UIView.animateKeyframesWithDuration(duration, delay: delay, options: options, animations: {
  
              UIView.addKeyframeWithRelativeStartTime(0, relativeDuration: 0, animations: {
  
                  self.polyRotate.transform = CGAffineTransformMakeRotation(1/3 * CGFloat(M_PI * 2))
              })
              UIView.addKeyframeWithRelativeStartTime(0, relativeDuration: 0, animations: {
                  self.polyRotate.transform = CGAffineTransformMakeRotation(2/3 * CGFloat(M_PI * 2))
              })
              UIView.addKeyframeWithRelativeStartTime(0, relativeDuration: 0, animations: {
                  self.polyRotate.transform = CGAffineTransformMakeRotation(3/3 * CGFloat(M_PI * 2))
              })
  
              }, completion: { (Bool) in
                  let vc : AnyObject! = self.storyboard?.instantiateViewControllerWithIdentifier("NextView")
                  self.showViewController(vc as UIViewController, sender: vc)
          })
  </code></pre>