diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index df1ba37c7..1ea187b56 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -215,7 +215,9 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { headerView.addGestureRecognizer(tap) // Without this the swipe gesture registers on the cell below - headerView.addGestureRecognizer(UIPanGestureRecognizer(target: nil, action: nil)) + let gestureRecognizer = UIPanGestureRecognizer(target: nil, action: nil) + gestureRecognizer.delegate = self + headerView.addGestureRecognizer(gestureRecognizer) headerView.interactions.removeAll() if section != 0 { @@ -1229,3 +1231,13 @@ private extension MasterFeedViewController { } } + +extension MasterFeedViewController: UIGestureRecognizerDelegate { + func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { + guard let gestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer else { + return false + } + let velocity = gestureRecognizer.velocity(in: self.view) + return abs(velocity.x) > abs(velocity.y); + } +}