 
 class TranslationAnimationController: NSObject, UIViewControllerAnimatedTransitioning {
 
-    @IBInspectable var isDismissing: Bool = true
+    @IBInspectable var isPresenting: Bool = true
     @IBInspectable var duration: NSTimeInterval = 0.3
     @IBInspectable var leftInset: CGFloat = 0.0
     @IBInspectable var rightInset: CGFloat = 0.0

        ) -> UIViewControllerAnimatedTransitioning?
    {
        let animationController = self.animationController()
        animationController.isDismissing = false
        return animationController
    }
    
    func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        let animationController = self.animationController()
        animationController.isDismissing = true
        return animationController
    }
    

    }
    
    @objc func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
        let key = isPresenting ? UITransitionContextToViewControllerKey : UITransitionContextFromViewControllerKey
        if let presentedViewController = transitionContext.viewControllerForKey(key),
            let presentedView = presentedViewController.view,
            let containerView = isPresenting ? transitionContext.containerView() : presentedView.superview
        {
            let dismissedFrame = dismissedFrameInContainerView(containerView)
            var endFrame: CGRect
            if isPresenting {
                containerView.addSubview(presentedView)
                presentedView.frame = dismissedFrame
                endFrame = presentedFrameInContainerView(containerView)
            } else {
                endFrame = dismissedFrame
            }
            UIView.animateWithDuration(
                duration,
                delay: 0.0,
                options: UIViewAnimationOptions.CurveEaseInOut,
                animations: {
                    presentedView.frame = endFrame
                }
                )
            { finished in
                transitionContext.completeTransition(true)
                if !self.isPresenting {
                    presentedView.removeFromSuperview()
                }
            }
        }
    }

}

extension UIViewController {
