     public var boundingMargin: CGFloat = 20
     
     fileprivate var gestureRecognizerProxy: UIPanGestureRecognizer?
-    fileprivate weak var modalViewController: UIViewController!
     fileprivate var transitionContext: UIViewControllerContextTransitioning?
     fileprivate var panGestureStartLocationY: CGFloat = 0.0
+    fileprivate var draggingState: DraggingState = .default
+    fileprivate var animationMode: AnimationMode = .presentation
+    fileprivate var isSwiping = false
+    fileprivate var dismissed = false
+
+    fileprivate weak var modalViewController: UIViewController!
     fileprivate lazy var backgroundView: UIView = {
         let view = UIView(frame: UIScreen.main.bounds)
         view.backgroundColor = .black

        self.gestureRecognizerProxy = gestureRecognizerProxy
    }

    fileprivate func removeGestureRecognizerFromModalViewController() {
        guard let gestureRecognizerProxy = gestureRecognizerProxy else { return }
        guard let gestureRecognizers = modalViewController.view.gestureRecognizers else { return }
        guard gestureRecognizers.contains(gestureRecognizerProxy) else { return }
        
        modalViewController.view.removeGestureRecognizer(gestureRecognizerProxy)
        self.gestureRecognizerProxy = nil
    }
    
    internal func handlePanGesture(recognizer: UIPanGestureRecognizer) {
        isSwiping = true
        
        let location = recognizer.location(in: modalViewController.view.window)

        draggingState = .dragging
        modalViewController.dismiss(animated: true, completion: nil)
        dismissed = true
    }

    private func removeGestureRecognizerFromModalViewController() {
        guard let gestureRecognizerProxy = gestureRecognizerProxy else { return }
        guard let gestureRecognizers = modalViewController.view.gestureRecognizers else { return }
        guard gestureRecognizers.contains(gestureRecognizerProxy) else { return }
        
        modalViewController.view.removeGestureRecognizer(gestureRecognizerProxy)
        self.gestureRecognizerProxy = nil
    }
}

