             self.presentingViewController?.dismissModalViewControllerAnimated(true)
         }
     }
+    
+    func userDidPan(panRecognizer: UIPanGestureRecognizer) {
+        // Many thanks to https://github.com/u10int/URBMediaFocusViewController
+        let location = panRecognizer.locationInView(self.view)
+        let boxLocation = panRecognizer.locationInView(self.currentViewController!.view)
+        
+        if (panRecognizer.state == .Began) {
+            animator.removeBehavior(snapBehaviour)
+            animator.removeBehavior(pushBehaviour)
+            let centerOffset = UIOffsetMake(boxLocation.x - CGRectGetMidX(self.currentViewController!.view.bounds), boxLocation.y - CGRectGetMidY(self.currentViewController!.view.bounds));
+            attachmentBehaviour = UIAttachmentBehavior(item: self.currentViewController!.view, offsetFromCenter: centerOffset, attachedToAnchor: location)
+            animator.addBehavior(attachmentBehaviour)
+        } else if (panRecognizer.state == .Changed) {
+            attachmentBehaviour!.anchorPoint = location
+        } else if (panRecognizer.state == .Ended) {
+            animator.removeBehavior(attachmentBehaviour)
+            attachmentBehaviour = nil
+            
+            let runningOnPad = UIDevice.currentDevice().userInterfaceIdiom == .Pad
+            // need to scale velocity values to tame down physics on the iPad
+            let deviceVelocityScale = runningOnPad ? 0.2 : 1.0
+            let deviceAngularScale = runningOnPad ? 0.7 : 1.0
+            // factor to increase delay before `dismissAfterPush` is called on iPad to account for more area to cover to disappear
+            let deviceDismissDelay = runningOnPad ? 1.8 : 1.0
+            let velocity = panRecognizer.velocityInView(view)
+            let velocityAdjust = 10.0 * deviceVelocityScale
+            
+            
+            let minimumVelocityRequiredForPush = 50.0
+            
+            animator.addBehavior(snapBehaviour)
+            animator.addBehavior(pushBehaviour)
+        }
+    }
 }

            currentViewController.removeFromParentViewController()
            currentViewController.view.removeFromSuperview()
            currentViewController.didMoveToParentViewController(nil)
        }
        
        currentViewController = delegate.viewControllerAtIndex(index)

        let animator = UIDynamicAnimator(referenceView: self.view)
        return animator
    }()
    @lazy var panRecognizer: UIPanGestureRecognizer = {
        let panRecognizer = UIPanGestureRecognizer(target: self, action: "userDidPan:")
        return panRecognizer
    }()
    var snapBehaviour: UISnapBehavior?
    var pushBehaviour: UIPushBehavior?
    var attachmentBehaviour: UIAttachmentBehavior?
    var currentViewController: UIViewController?
    var index: UInt {
        didSet {
