title: How to get the location/indexPath of a swipe gesture?
body: <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
      self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: &quot;SavedExercise&quot;)
      
      let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(respondToSwipeGesture))
      self.view.addGestureRecognizer(swipeRight)
  }
  
  @objc func respondToSwipeGesture(gesture: UIGestureRecognizer) {
      currentIndex = self.tableView.indexPathForSelectedRow
      let ac = UIAlertController(title: &quot;Want to delete from saved exercises?&quot;, message: nil, preferredStyle: .actionSheet)
      ac.addAction(UIAlertAction(title: &quot;Yes&quot;, style: .default, handler: swipedRight))
      ac.addAction(UIAlertAction(title: &quot;No&quot;, style: .cancel))
  
  }
  
  @objc func swipedRight(action: UIAlertAction) {
      if let unwrapped = currentIndex {
          savedExercises.remove(at: unwrapped.row)
          self.tableView.reloadData()
      } else {
          print(&quot;right swipe messed up somewhere&quot;)
      }
  }
  </code></pre>
  <p>Saw a lot of answers, but they were all in obj-c and not Swift. The current indexPathForSelectedRow variable doesn't seem to do the trick. Thanks!</p>