title: Proper way to implement a custom UIViewController interactive transition using UIViewControllerInteractiveTransitioning Delegate Protocol
body: <p>I'm interested in a concise example of how to create an <code>NSObject</code> subclass that implements the <code>UIViewControllerInteractiveTransitioning</code> protocol to manage a custom interactive transition between two <code>UIViewController</code>s. Ideally in response to a swipe gesture. Something akin to the iOS7 default interactive swipe that now comes with <code>UINavigationController</code>, but a custom/manual implementation example of this. </p>
  
  <p>I've read the docs:</p>
  
  <ul>
  <li><a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewControllerContextTransitioning_protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40013057" rel="noreferrer">UIViewControllerContextTransitioning</a></li>
  <li><a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPercentDrivenInteractiveTransition_class/Reference/Reference.html" rel="noreferrer">UIPercentDrivenInteractiveTransition</a></li>
  <li><a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewControllerInteractiveTransitioning_protocol/Reference/Reference.html#//apple_ref/occ/intf/UIViewControllerInteractiveTransitioning" rel="noreferrer">UIViewControllerInteractiveTransitioning</a></li>
  <li><a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewControllerAnimatedTransitioning_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIViewControllerAnimatedTransitioning" rel="noreferrer">UIViewControllerAnimatedTransitioning</a></li>
  </ul>
  
  <p>And looked at a few examples elsewhere:</p>
  
  <ul>
  <li><a href="https://github.com/dorada/UIViewController-Interactive-Transitions" rel="noreferrer">one</a></li>
  <li><a href="https://github.com/petermeyers1/PMInteractiveNavigationController" rel="noreferrer">two</a></li>
  <li><a href="http://www.doubleencore.com/2013/09/ios-7-custom-transitions/" rel="noreferrer">three</a></li>
  <li><a href="https://github.com/alfiehanssen/ios-viewcontroller-containment" rel="noreferrer">four</a> (I set this up but it's more about <code>UIViewController</code> <code>containment</code> and manual implementation of these transitions rather than <code>UIViewControllerInteractiveTransitioning</code> </li>
  </ul>
  
  <p>The docs are fairly clear but dont reference sample code. And the examples leave a little to be desired (unanswered questions about how the various pieces are tied together). </p>
  
  <p>So my questions are:</p>
  
  <ol>
  <li>Can someone help fill in the blanks about how to tie a gesture (e.g. a swipe) to the object that implements the <code>UIViewControllerInteractiveTransitioning</code> protocol?</li>
  <li>What is the relationship between object implementing the UIViewControllerInteractiveTransitioning protocol and that implementing the UIViewControllerAnimatedTransitioning protocol? Seems like you must have both to trigger interactive transitions...</li>
  </ol>
  
  <p>Thanks in advance...</p>