How to pass control from one gesture recogniser to the other
<p>I have the following setup. </p>

<ul>
<li><p>A main view controller (MainViewController) contains another view controller (ListViewController) in a parent-child view controllers configuration. </p></li>
<li><p>The ListVC starts somewhere along the bottom of the MainVC. The ListVC contains UIView at the top and a table view at the bottom. The table view has a pan gesture recogniser attached to it.</p></li>
</ul>

<p>What I wanted to achieve is as I pull the ListVC upwards via the pan gesture, it goes up towards the top of the screen. When it reaches the top (or to be more precisely, some distance below the top layout guide), the listVC stops moving in mainVC and the table view starts scrolling. It's almost like the I've transferred control from the pan gesture to the table view's gestures. </p>

<p>The way I'm doing this now is implementing the <code>UIGestureRecognizerDelegate</code> protocol.</p>

<pre><code>func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -&gt; Bool {
    return true
}
</code></pre>

<p>and</p>

<pre><code>func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -&gt; Bool {
    if gestureRecognizer == pullGesture {          
      return pullGestureIsPriority
    }

    return false
}
</code></pre>

<p>and</p>

<pre><code>func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRequireFailureOf otherGestureRecognizer: UIGestureRecognizer) -&gt; Bool {
  if gestureRecognizer == pullGesture {        
    return !pullGestureIsPriority
  }

  return false
}
</code></pre>

<p>pullGesutre is a priority if the listVC hasn't reached the top. And I fail the pullGesture by setting <code>self.pullGesture.isEnabled = false</code> followed immediately by <code>self.pullGesture.isEnabled = true</code>. </p>

<p>Now it all works fine; I was able to pull it up without the table view scrolling up, when listVC reaches the top, I fail the pull gesture, so table view starts scrolling up. The problem came when I scrolled the table view down until the top of the table view was reached, at which point, I'd hoped that the listVC would come down via the pull gesture. But this wasn't happening. Somehow, the pullGesture has been removed from the chain of touch events.</p>

<p>Anybody has an idea how I could achieve this?</p>

<p>Note, effectively I'm trying to replicate how Apple does to their Map in iOS 10. I've also attached a little gif to demonstrate what I meant.</p>

<p><a href="https://i.stack.imgur.com/s4N9X.gif" rel="nofollow noreferrer">demo image</a></p>

<p>A demo project can be found here.</p>

<p><a href="https://gitlab.com/pnuts2/MapClone.git" rel="nofollow noreferrer">demo project</a></p>