title: CGAffineTransform.identity doesn't reset transform correctly after device rotation
body: <p>I am doing a custom transition and if after present animation, device will be rotated and then destinationVC will be dismissed, originVC transform is not correct (not fulfil screen). If there is no device rotation, everything works perfectly fine. Does any one can help me?</p>
  
  <p>Here is my code for present and dismiss animation:</p>
  
  <pre><code>func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
          guard let originViewController = transitionContext.viewController(forKey: .from),
              let destinationViewController = transitionContext.viewController(forKey: .to) else { return }
  
          destinationViewController.view.transform = CGAffineTransform(translationX: 0, y: destinationViewController.view.frame.height)
          let duration = transitionDuration(using: transitionContext)
  
          UIView.animate(withDuration: duration, animations: {
              destinationViewController.view.transform = CGAffineTransform(translationX: 0, y: 0)
              originViewController.view.transform = originViewController.view.transform.scaledBy(x: 0.95, y: 0.95)
              originViewController.view.layer.cornerRadius = 8.0
          }, completion: { completed in            
              transitionContext.completeTransition(completed)
          })
      }
  
  func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
          guard let originViewController = transitionContext.viewController(forKey: .from),
              let destinationViewController = transitionContext.viewController(forKey: .to) else { return }
  
          let duration = transitionDuration(using: transitionContext)
  
          UIView.animate(withDuration: duration, animations: {
              originViewController.view.transform = CGAffineTransform(translationX: 0, y: destinationViewController.view.frame.height)
              destinationViewController.view.transform = CGAffineTransform.identity
              destinationViewController.view.layer.cornerRadius = 0.0
          }, completion: { completed in
              transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
          })
      }
  </code></pre>
  
  <p>Screens:
  Before present animation
  <a href="https://i.stack.imgur.com/eEAq6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eEAq6.png" alt="Before present animation"></a>
  After present animation
  <a href="https://i.stack.imgur.com/KVpov.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KVpov.png" alt="After present animation"></a>
  After device rotation
  <a href="https://i.stack.imgur.com/gyevA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gyevA.png" alt="After device rotation"></a>
  After dismiss animation
  <a href="https://i.stack.imgur.com/EqEm3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EqEm3.png" alt="After dismiss animation"></a></p>
  
  <p>EDIT:
  when I add <code>destinationViewController.view.frame = transitionContext.finalFrame(for: destinationViewController)</code> to dismiss animation everything seems works fine but I don't know if this is right way</p>