title: Swift viewWillTransition not called
body: <p>I'm creating a full screen image gallery using a <code>UICollectionView</code>. When the user rotates the device, I perform updates to the <code>UICollectionView</code> within </p>
  
  <p><code>func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)</code></p>
  
  <p>I present this <code>UIViewController</code> modally and have a <code>UICollectionView</code> taking up the full screen. Within <code>viewDidLoad</code>, I create the flow layout as:</p>
  
  <pre><code>let flowLayout = UICollectionViewFlowLayout()
  flowLayout.scrollDirection = .horizontal
  flowLayout.minimumInteritemSpacing = 0
  flowLayout.minimumLineSpacing = 0
  photosCollectionView.isPagingEnabled = true
  photosCollectionView.setCollectionViewLayout(flowLayout, animated: true)
  </code></pre>
  
  <p>I also have the size as:</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -&gt; CGSize {
      return photosCollectionView.frame.size
  }
  </code></pre>
  
  <p>When I rotate my device, <code>viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)</code> is never called, which causes the <code>UICollectionViewLayout</code> to not update. While I rotate the device, I do get the message:</p>
  
  <pre><code>The behavior of the UICollectionViewFlowLayout is not defined because: the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
  </code></pre>
  
  <p>I've read online that I can add:</p>
  
  <pre><code>self.automaticallyAdjustsScrollViewInsets = false
  </code></pre>
  
  <p>to the <code>UIViewController</code>, but that had no affect. There are no content or section insets with the <code>UICollectionView</code>. </p>
  
  <p>I also have the <code>super.viewWillTransition</code> called within the function as well. Can anyone assist me on what could be causing this issue?</p>