Like setting color in the XCASSETS, but with code and applyable < iOS 12. By Encapsulating the iOS versioning in the AutoUpdateColor, we can have the UIView.color = ... without the color setup.
// ViewController.swift
let themeMainColor = AutoUpdateColor(lightColor: .blue, darkColor: .yellow)
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = themeMainColor
}
}
The closure feed to UIColor.init can have more conditions on ENV, such as different theme.