title: Calculating contentSize for UIScrollView when using Auto Layout
body: <p>Here is a quick question about something which works, but could be written much better. I have a <code>UIScrollView</code> and a list of objects laid out inside, one under the other. Everything is done during <code>viewDidLoad()</code> and the placement of the objects uses <code>Auto Layout</code>. Here is what I do to set the <code>contentSize</code> height of the <code>UIScrollView</code> to its appropriate value.</p>
  
  <pre><code>override func viewDidAppear(animated: Bool) {
      super.viewDidAppear(animated)
      globalView.contentSize = CGSize(width: globalView.frame.width,
                                      height: globalView.frame.height * 1.59)
  }
  </code></pre>
  
  <p>It works, but the arbitrary value 1.59 has obviously been decided by me trying a few possible values. <strong>What is the proper way to compute the contentSize in such a case?</strong> I am doing everything programmatically.
  Searching the net didn't lead me to any simple and clear answer, so eventhough it may be a somewhat duplicate question I decided to reformulate it.</p>