provide creates a new color object based on the traits in the provided trait collection. @available(iOS 13.0, *) public init(dynamicProvider: @escaping (UITraitCollection) -> UIColor) } extension UIColor { static let dynamicColor = UIColor { (traitCollection: UITraitCollection) -> UIColor in if traitCollection.userInterfaceStyle == .dark { return .white } else { return .black } } }