title: Swipe Gestures - Swift 3
body: <p>I need my app to respond to a swipe gesture, and I got this code so far. But for some reason when I swipe, the app crashes. What's the problem please? I use swift 3 in xcode. Thank you</p>
  
  <pre><code>    override func viewDidLoad() {
      super.viewDidLoad()
  
      var swipeRight = UISwipeGestureRecognizer(target: self, action: "respondToSwipeGesture:")
      swipeRight.direction = UISwipeGestureRecognizerDirection.Right
      self.view.addGestureRecognizer(swipeRight)
  
      var swipeDown = UISwipeGestureRecognizer(target: self, action: "respondToSwipeGesture:")
      swipeDown.direction = UISwipeGestureRecognizerDirection.Down
      self.view.addGestureRecognizer(swipeDown)
  }
  
  func respondToSwipeGesture(gesture: UIGestureRecognizer) {
  
      if let swipeGesture = gesture as? UISwipeGestureRecognizer {
  
  
          switch swipeGesture.direction {
              case UISwipeGestureRecognizerDirection.Right:
                  print("Swiped right")
              case UISwipeGestureRecognizerDirection.Down:
                  print("Swiped down")
              case UISwipeGestureRecognizerDirection.Left:
                  print("Swiped left")
              case UISwipeGestureRecognizerDirection.Up:
                  print("Swiped up")
              default:
                  break
          }
      }
  }
  </code></pre>