title: Set UIView size to fit subViews
body: <p>I'm having a <code>UIView</code> that's containing two UILabels, which have dynamic heights. I want the <code>UIView</code> to fit the size of the UILabels + some padding. Right now I'm drawing the labels and then sets the UIView's width and height constraints to the combined size of the labels.</p>
  <p>Right now I'm doing this:</p>
  <pre><code>func populateWithMessage(headline: String?, message: String) {
      // Sets text
      self.headerLabel.text = headline
      self.messageLabel.text = message
  
      self.headerLabel.sizeToFit()
      self.messageLabel.sizeToFit()
  
      self.layoutSubviews()
  
      // Finding the label with the greatest width
      var longestLabel: UILabel!
      if self.headerLabel.frame.width &gt; self.messageLabel.frame.width {
         longestLabel = self.headerLabel
     } else {
         longestLabel = self.messageLabel
     }
     
     let combinedLabelHeight = self.headerLabel.frame.height + self.messageLabel.frame.height
     
     // Update the container view's constraints
     self.containerViewWidtConstraint.constant = longestLabel.frame.width + 10
     self.containerViewHeightConstraint.constant = combinedLabelHeight + 10
  
     self.updateConstraints()
  }
  </code></pre>
  <p>Unfortunately it doesn't work. I'm using Swift 2.3 and Autolayout.</p>