title: Swift 3: nested UIView(s) corners not getting rounded
body: <p>I have a <strong>UIView</strong> named <strong>parent</strong>. Inside parent are nested two UIViews named <strong>Child1</strong> and <strong>Child2</strong>.(see image)
  <a href="https://i.stack.imgur.com/7lVQ0.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/7lVQ0.jpg" alt="Parent-Child Relation"></a></p>
  
  <p>Note: There are <strong>no margins</strong> i.e. 0 margin b/w both Child1, Child2 and Parent.</p>
  
  <p>I am trying to <strong>round the corners of Parent</strong>.</p>
  
  <pre><code>parentView.layer.cornerRadius = 10
  </code></pre>
  
  <p>This <strong>does not round</strong> up the corners of the children.(see image)</p>
  
  <p><a href="https://i.stack.imgur.com/mR8ve.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mR8ve.png" alt="The top corners do not get rounded"></a></p>
  
  <p>The <strong>top corners</strong> do <strong>not</strong> end up getting <strong>round</strong> here. The bottom corners are rounded because Child2 is transparent while Child1 is colored. Parent is white in color.</p>
  
  <p>What I've tried so far:</p>
  
  <pre><code>parentView.layer.cornerRadius = 10
  child1.clipsToBounds = true
  </code></pre>
  
  <p>No luck</p>
  
  <pre><code>parentView.layer.cornerRadius = 10
  let maskLayer = CAShapeLayer()
  maskLayer.path = UIBezierPath(roundedRect: view.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: 10, height: 10)).cgPath
  child1.layer.mask = maskLayer
  </code></pre>
  
  <p>Still No luck</p>
  
  <p>Please help me out</p>