Я пытаюсь создать UIView с закругленными углами, при этом закругленные углы отрисовываются идеально, но позади вида есть странный черный фон.Как избавиться от черного фона?
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
RENDERED UI
РЕДАКТИРОВАТЬ
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