title: viewWillTransition is giving the wrong size
body: <p>I am making a custom keyboard. I want to generate the keys'(UIButtons) width and height based on the view's width and height.</p>
  
  <p>When the keyboard is loaded initially, viewDidAppear correctly determines the height of the view. (375 x 216)</p>
  
  <pre><code>override func viewDidAppear(_ animated: Bool) {
          super.viewDidAppear(animated)
          self.renderKeys()
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Dmlb6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Dmlb6.png" alt="enter image description here"></a></p>
  
  <p>When rotating to Landscape, it invokes viewWillTransition</p>
  
  <pre><code>override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
      super.viewWillTransition(to: size, with: coordinator)
  
      NSLog("toSize \(size.width) x \(size.height)")
  
      coordinator.animate(alongsideTransition: {(_ context: UIViewControllerTransitionCoordinatorContext) -&gt; Void in
          NSLog("animating \(self.view.frame.width) x  \(self.view.frame.height)")
  
      }, completion: {(_ context: UIViewControllerTransitionCoordinatorContext) -&gt; Void in
  
          NSLog("animationCompleted \(self.view.frame.width) x  \(self.view.frame.height)")
          self.renderKeys()
      })
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Uj13L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Uj13L.png" alt="enter image description here"></a></p>
  
  <p>Rotating back to Portrait results this.</p>
  
  <p><a href="https://i.stack.imgur.com/wkBR0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wkBR0.png" alt="enter image description here"></a></p>
  
  <p>What I found is that viewWillTransition's to size isn't correctly determining the size that the view will be or I am just misunderstanding the usage of the function. Even after the animation, I am not able to get right width and height of the view.</p>
  
  <p>Here is the debug log in order. </p>
  
  <pre><code>[28651:1348399] Calling viewDidAppear
  
  [28651:1348399] Cleaning keys
  [28651:1348399] toSize 667.0 x 216.0
  [28651:1348399] animating 667.0 x  216.0
  [28651:1348399] animationCompleted 667.0 x  216.0
  
  [28651:1348399] Cleaning keys
  [28651:1348399] toSize 375.0 x 162.0
  [28651:1348399] animating 375.0 x  162.0
  [28651:1348399] animationCompleted 375.0 x  162.0
  </code></pre>