     containerView.addSubview(viewController.view)
 
     UIView.animateWithDuration(animationDuration, animations: { [unowned self] in
-      self.transition(viewController, show: self.presentingViewController)
+      self.transition(presentedViewController, show: self.presentingViewController)
       }, completion: { _ in
         transitionContext.completeTransition(true)
         UIApplication.sharedApplication().keyWindow!.addSubview(screens.to.view)

    let screens : (from: UIViewController, to: UIViewController) = (
      transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)!,
      transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)!)
    let viewController = !presentingViewController
      ? screens.to as UIViewController
      : screens.from as UIViewController


  public var transitionDuration: NSTimeInterval = 0.6
  public var animationDuration: NSTimeInterval = 0.3
  var closure: ((controller: UIViewController, show: Bool) -> Void)

  public required init(closure: ((controller: UIViewController, show: Bool) -> Void)) {
    self.closure = closure
