Junior — Senior
How is the final screen color determined in an iOS application
livecode
Task condition
In this example, it is necessary to understand which color will ultimately be visible to the user on the screen and why that particular color is displayed. Pay attention to the order of setting the backgroundColor properties of the UIView and its layer, as well as how these properties interact with similar parameters of the root view view.
func viewDidLoad() {
super.viewDidLoad()
let testView = UIView()
view.addSubview(testView)
testView.frame = view.bounds
testView.backgroundColor = .red
testView.layer.backgroundColor = UIColor.yellow.cgColor
view.backgroundColor = .green
view.layer.backgroundColor = UIColor.black.cgColor
}