swift 5 change all view controller background color code example
Example 1: swift change background color
self.view.backgroundColor = UIColor.red
Example 2: how to change background color of stackview swift
extension UIStackView {
func addBackground(color: UIColor) {
let subView = UIView(frame: bounds)
subView.backgroundColor = color
subView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
insertSubview(subView, at: 0)
}
}