title: UIView dynamic height in Swift and Xcode
body: <p>In Xcode 7.3 I have the following setup with Auto Layout: 
  <a href="https://i.stack.imgur.com/yTY7P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yTY7P.png" alt="enter image description here"></a></p>
  
  <p>When I click the button, I add a UILabel to the Red UIView with <code>addSubview()</code>. What I am trying to achieve is to automatically resize both the red UIView and the green UIView when the size of the combined labels exceeds the red UIView.</p>
  
  <p>I have tried to calculate the size of all the labels, then set the <code>frame.size.height</code> of the red view in <code>didLayoutSubView()</code>, which kinda worked, but then I had trouble when also doing the same with the green UIView, based on the red UIView. It also became very cumbersome when nesting a lot of UIViews. There must be some better way to accomplish this? (without UIStackView). </p>
  
  <p>I have also played around with different Auto Layout settings with no luck. Bonus if this could also be added to a UIScrollView and make the contentSize of that also adjust itself! </p>
  
  <p>All this seems like it should be such a trivial thing to do, so I think I am overlooking something small and easy. Any guidance on how to accomplish this, using Swift and/or Interface Builder would be highly appreciated.</p>