 
     public func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
 
-        // Take screenshot and store resulting UIImage
-        screenCapture = UIWindow.screenShot()
-
-        // Grab the view in which the transition should take place.
-        // Coalesce to UIView()
-        let container = containerView(transitionContext) ?? UIView()
-
-        // Set source and destination view controllers
-        let fromVC = fromViewController(transitionContext) ?? UIViewController()
-        let toVC = toViewController(transitionContext) ?? UIViewController()
-
-        // Set completion handler for transition
-        let completion = {transitionContext.completeTransition(!transitionContext.transitionWasCancelled())}
-
-        switch transitionType {
+        setupTransition(transitionContext)
+
+        guard let fromVC = fromVC,
+            toVC = toVC,
+            container = container,
+            completion = completion else {
+                print("animation setup failed")
+                return
+        }
+
+        gestureRecognizer = UIPanGestureRecognizer(target: self, action: Selector("didPan:"))
+        if let gestureRecognizer = gestureRecognizer {
+            gestureRecognizer.delegate = self
+            sourceViewController?.view.window?.addGestureRecognizer(gestureRecognizer)
+        }
+
+        switch(transitionType) {
         case .Push:
-            push(toVC, fromViewController: fromVC, containerView: container, completion: completion)
+            push(toViewController: toVC, fromViewController: fromVC, containerView: container, completion: completion)
             break
         case .Pop:
             pop(toVC, fromViewController: fromVC, containerView: container, completion: completion)
             break
-        }
-    }
-
-}
-
-// MARK: - Private
+        case .Interactive:
+            push(50.0, toViewController: toVC, fromViewController: fromVC, containerView: container, completion: nil)
+            break
+        }
+    }
+
+}
 
 private extension SplitTransition {
+
+    // MARK: private interface
 
     // Returns the view controller being navigated away from
     func fromViewController(transitionContext: UIViewControllerContextTransitioning?) -> UIViewController? {

import UIKit


public class SplitTransition: NSObject {

    /**
     The type of animated transition.

     - Push: A push transition.
     - Pop:  A pop transition.
     */
    public enum TransitionType {
        case Push
        case Pop
    }

    /**
     * The duration (in seconds) of the transition.
     */

        return imageView
    }()

    public var sourceViewController: UIViewController?
    public var interactive: Bool = true
    private var canScrollToZero: Bool = false
    private var transitionProgress: CGFloat = 0.0
    private var gestureRecognizer: UIPanGestureRecognizer?
    private var transitionContext: UIViewControllerContextTransitioning?
    private var previousTouchLocation: CGPoint = CGPointZero
    private var container: UIView?
    private var toVC: UIViewController?
    private var fromVC: UIViewController?
    private var completion: (() -> ())?

    /**
     * Screen capture extending from split location
     * to bottom of screen
