title: UIView with round corners has black background
body: <p>I am trying to create a UIView with round corners the round corners are rendering perfectly but there is an odd black background behind the view. How do I get rid of the black background?</p>
  
  <p><strong>CODE</strong></p>
  
  <pre><code>import UIKit
  import PlaygroundSupport
  
  // The background rectange for main view
  let backgroundRectangle = CGRect(x: 0, y: 0, width: 500, height: 500)
  // Main view
  let mainView = UIView(frame: backgroundRectangle)
  // Color of the main view
  mainView.backgroundColor = .darkGray
  // Corner radius
  mainView.layer.cornerRadius = 50
  mainView.layer.masksToBounds = false
  // Present the view to Playground's live view
  PlaygroundPage.current.liveView = mainView
  </code></pre>
  
  <p><strong>RENDERED UI</strong></p>
  
  <p><a href="https://i.stack.imgur.com/AwH6D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AwH6D.png" alt="UIVIEW"></a></p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>import UIKit
  import PlaygroundSupport
  
  // Holder rectangle
  let holderRectangle = CGRect(x: 0, y: 0, width: 500, height: 500)
  // Holder view
  let holderView = UIView(frame: holderRectangle)
  // The background color of the holder view is clear
  holderView.backgroundColor = .clear
  
  // Main rectangle
  let mainRectangle = CGRect(x: 0, y: 0, width: 500, height: 500)
  // Main view
  let mainView = UIView(frame: mainRectangle)
  // The background color of the main view is black
  mainView.backgroundColor = .white
  // Create a corner radius for the main view
  mainView.layer.cornerRadius = 30
  mainView.layer.masksToBounds = false
  
  // Make the main view a subview of the holder view
  holderView.addSubview(mainView)
  
  // Present the holder view in the live view
  PlaygroundPage.current.liveView = holderView
  </code></pre>