title: Scroll view with container view doesn't adjust the content size correctly
body: <p>I have a view hierarchy arranged this way:</p>
  
  <pre><code>main view
  ---- scroll view
  -------- label
  -------- label
  -------- text view
  -------- horizontal stack view
  -------- divider view (UIView)
  -------- label
  -------- container view (embeds a child view controller)
  </code></pre>
  
  <p><strong>The embedded child view controller is a <em>UICollectionViewController</em>.</strong></p>
  
  <p>Now the problem is that the collection view controller contains a lot of elements, and I expected the scroll view to automatically adjust its content size in order to take into account of the collection view height too, but it doesn't. So at the moment I can just see the first elements of the collection view, but I cannot scroll down. I tried to manually adjust the content size of the collection view this way:</p>
  
  <pre><code>func adjustContentSize() {
      var contentRect: CGRect = .zero
  
      for subview in self.scrollView.subviews {
          contentRect = contentRect.union(subview.frame)
      }
  
      self.scrollView.contentSize = contentRect.size
  }
  </code></pre>
  
  <p>But the content size is still incorrect: it is exactly equal to the window size, even if it should be a lot higher in order to make place for all the elements inside the collection view. I think that the problem has to do mainly with the fact that I am embedding a child view controller, because normally the scroll view content size is adjusted automatically. But what to do in this case? how to tell the right content size to the scroll view?</p>