title: Swift: How to detect when pan gesture is dismissed / cancelled?
body: <p>I have a custom table cell that is swipeable. I'm using this library to inherit from: <a href="https://github.com/alikaragoz/MCSwipeTableViewCell" rel="nofollow noreferrer">https://github.com/alikaragoz/MCSwipeTableViewCell</a></p>
  
  <p>In order to prevent 2 cells from being swiped at the same time, I have a global boolean that I just toggle <code>true / false</code> when ever something is swiped.</p>
  
  <p>However, I can't find any callbacks for when the user starts a swipe but lets go, which essentially cancels the swipe. Is there a way to do this? I'm looking for a callback similar to <code>gestureRecognizerShouldBegin</code>, but for when a gesture is dismissed / cancelled.</p>
  
  <pre><code>typealias SwipeHandler = () -&gt; ()
  
  class OrderCellManager {
    static var swiping = false
  }
  
  class OrderPreparingTableViewCell: MCSwipeTableViewCell {
    override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -&gt; Bool {
      if (!OrderCellManager.swiping) {
        OrderCellManager.swiping = true
        return true
      } else {
        return false
      }
    }
  
    func displayOrder(order: AppState.Order, clock: Clock, fDone: @escaping SwipeHandler, fDelete: @escaping SwipeHandler) -&gt; OrderPreparingTableViewCell {
      ..
      self.setSwipeGestureWith(lSwipe, color: Config.ColorSwipeDelete, mode: .exit, state: .state1, completionBlock:currySwipe(f: fDelete))
      self.setSwipeGestureWith(rSwipe, color: Config.ColorSwipeDone, mode: .exit, state: .state3, completionBlock:currySwipe(f: fDone))
      ..
    }
  
    // MARK: Private
  
    private func currySwipe(f: @escaping SwipeHandler) -&gt; MCSwipeCompletionBlock {
      return { (a: MCSwipeTableViewCell?, b: MCSwipeTableViewCellState, c: MCSwipeTableViewCellMode) -&gt; () in
        OrderCellManager.swiping = false
  
        f()
      }
    }
  
  }
  </code></pre>