title: Custom UIViewControllerAnimatedTransitioning shows black screen when finished
body: <p>I have a segue, that is triggered via a button that shows another view controller modally over current context. I'm using a custom class to customize the transition, which is this:</p>
  
  <pre><code>class ShowAnimator: NSObject {
  }
  
  
  extension ShowAnimator: UIViewControllerAnimatedTransitioning {
  func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -&gt; TimeInterval {
      return 0.5
  }
  func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
      guard
          let fromVC = transitionContext.viewController(forKey: .from),
          let toVC = transitionContext.viewController(forKey: .to) else {
              return
      }
      let containerView = transitionContext.containerView
      containerView.insertSubview(fromVC.view, belowSubview: toVC.view)
      let toFrame = transitionContext.finalFrame(for: toVC)
      let screenBounds = UIScreen.main.bounds
      let bottomLeftCorner = CGPoint(x: screenBounds.width, y: 0)
      let finalFrame = CGRect(origin: bottomLeftCorner, size: screenBounds.size)
  
      UIView.animate(withDuration: transitionDuration(using: transitionContext),
                     animations: {
                      fromVC.view.frame = finalFrame
      },
                     completion: { _ in
                      transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
      }
      )
  }
  }
  </code></pre>
  
  <p>In my main view controller, I have these relevant functions:</p>
  
  <pre><code>let showAnimator = ShowAnimator()
      override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
      let destination = segue.destination
      destination.transitioningDelegate = self
  }
  
  
  func animationController(forDismissed dismissed: UIViewController) -&gt; UIViewControllerAnimatedTransitioning? {
      return nil
  }
  func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -&gt; UIViewControllerAnimatedTransitioning? {
      return showAnimator
  }
  </code></pre>
  
  <p>Note that this class is a ViewController as well as a <code>UIViewControllerTransitioningDelegate</code>
  However, whenever I press the button to perform my segue, it does the animation properly, but once it's finished it just shows a black screen, rather than the next ViewController.</p>