                     //Hide status bar
                     toViewController.presentingEnded()
                     completeTransition()
-                }) 
+                })
             }
             
         }

            }
            
            let toViewController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)!
            let fromView = fromViewController.view
            let toView = toViewController.view
            
            let completeTransition: () -> () = {
                // Add subview before completing transition
                UIApplication.shared.delegate?.window??.addSubview(toViewController.view)
                
                let isCancelled = transitionContext.transitionWasCancelled
                transitionContext.completeTransition(!isCancelled)
                
                if isCancelled {
                    container.insertSubview(toView!, belowSubview: fromView!)
                }
            }
            
            container.addSubview(toView!)
            container.addSubview(fromView!)
            
            if spring {
                UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: kDamping, initialSpringVelocity: kInitialSpringVelocity, options: UIViewAnimationOptions.curveEaseOut, animations: {
                    //Animate image view to the center
                    fromViewController.dismissingAnimation()
                    }, completion: { (finished) in
                        //End transition
                        fromViewController.dismissingEnded()
                        completeTransition()
                })
            }
            else {

            guard let toViewController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)! as? DTPhotoViewerController else {
                fatalError("view controller does not conform DTPhotoViewer")
            }
            let fromView = fromViewController.view!
            let toView = toViewController.view!
            toView.frame = container.bounds
            
            let completeTransition: () -> () = {
                let isCancelled = transitionContext.transitionWasCancelled
                transitionContext.completeTransition(!isCancelled)
            }
            
            container.addSubview(toView)
            
            if spring {
                UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: kDamping, initialSpringVelocity: kInitialSpringVelocity, options: UIViewAnimationOptions.curveEaseOut, animations: {
                    //Animate image view to the center
                    toViewController.presentingAnimation()
                }, completion: { (finished) in
                    toViewController.presentingEnded()
                    completeTransition()
                })
            }
            else {
