         
         if swipingToDismiss == nil { swipingToDismiss = (fabs(currentVelocity.x) > fabs(currentVelocity.y)) ? .Horizontal : .Vertical }
         guard let swipingToDismissInProgress = swipingToDismiss else { return }
-
+        
         swipeToDismissInitiationBlock?()
         imageViewModel.displacedView.hidden = false
         dynamicTransparencyActive = true
-
+        
         
         switch recognizer.state {
             

        }
    }
    
    
    func handleSwipeToDismissInProgress(swipeOrientation: SwipeToDismiss, forTouchPoint touchPoint: CGPoint) {
        
        switch (swipeOrientation, index) {
            
        case (.Horizontal, 0):
            
             swipeToDismissTransition?.updateInteractiveTransition(horizontalOffset: min(0, -touchPoint.x))
            
        case (.Horizontal, self.imageViewModel.imageCount - 1):

           swipeToDismissTransition?.updateInteractiveTransition(horizontalOffset: max(0, -touchPoint.x))
            
        case (.Vertical, _):
            
            swipeToDismissTransition?.updateInteractiveTransition(verticalOffset: -touchPoint.y)
        
        default: break
            
        }

        
        let presentingViewController = self.presentingViewController
        
        let maxIndex = self.imageViewModel.imageCount - 1
        
        switch (swipeOrientation, index) {
            
        case (.Vertical, _) where velocity.y < -thresholdVelocity: //All images VERTICAL UP direction
            
            swipeToDismissTransition?.finishInteractiveTransition(swipeOrientation, touchPoint: touchPoint.y, targetOffset: (view.bounds.height / 2) + (imageView.bounds.height / 2), escapeVelocity: velocity.y) {  [weak self] in
                self?.swipingToDismiss = nil
                presentingViewController?.dismissViewControllerAnimated(false, completion: nil)
            }
            
        case (.Vertical, _) where thresholdVelocity < velocity.y: //All images VERTICAL DOWN direction
            
            swipeToDismissTransition?.finishInteractiveTransition(swipeOrientation, touchPoint: touchPoint.y, targetOffset: -(view.bounds.height / 2) - (imageView.bounds.height / 2), escapeVelocity: velocity.y) {  [weak self] in
                self?.swipingToDismiss = nil
                presentingViewController?.dismissViewControllerAnimated(false, completion: nil)
            }
            
        case (.Horizontal, 0) where thresholdVelocity < velocity.x: //First image HORIZONTAL RIGHT direction
            
            swipeToDismissTransition?.finishInteractiveTransition(swipeOrientation, touchPoint: touchPoint.x, targetOffset: -(view.bounds.width / 2) - (imageView.bounds.width / 2), escapeVelocity: velocity.x) {  [weak self] in
                self?.swipingToDismiss = nil
                presentingViewController?.dismissViewControllerAnimated(false, completion: nil)
            }
            
        case (.Horizontal, maxIndex) where velocity.x < -thresholdVelocity:  //Last image HORIZONTAL LEFT direction
            
            swipeToDismissTransition?.finishInteractiveTransition(swipeOrientation, touchPoint: touchPoint.x, targetOffset: (view.bounds.width / 2) + (imageView.bounds.width / 2), escapeVelocity: velocity.x) {  [weak self] in
                self?.swipingToDismiss = nil
                presentingViewController?.dismissViewControllerAnimated(false, completion: nil)
            }
            
        default:
            
            swipeToDismissTransition?.cancelTransition() { [weak self] in
                self?.swipingToDismiss = nil
            }
        }
    }
