title: When is bounds and frame set for views/layers in Swift?
body: <p>I have something like this in a <code>UIView</code> subclass:</p>
  
  <pre><code>override var bounds : CGRect {
    didSet {
      somelayer.frame = bounds
    }
  }
  </code></pre>
  
  <p>In the corresponding <code>somelayer</code>, I have this:</p>
  
  <pre><code>override var bounds: CGRect {
    didSet {
      someFunction()
    }
  }
  </code></pre>
  
  <p>Now if the view is initialized using <code>super.init(frame: someFrame)</code>, the first block is not called. This appears to indicate that the <code>bounds</code> property is not set alongside <code>frame</code>.</p>
  
  <p>If I change the first block to <code>override var frame</code>, then it will be called by <code>super.init(frame: someFrame)</code>, and it will set the <code>frame</code> of <code>somelayer</code>. Interestingly, when that happens, the second block is called, suggesting that <code>bounds</code> and <code>frame</code> are set at the same time (which is what I'd expect, too).</p>
  
  <p>Am I missing anything here? </p>