can someone please tell me if I can change the color on below format using Color Set. For example, Instead of .blue, I want to use my own color set such as Color("colorname"). Is this possible
.onAppear {
UITableView.appearance().backgroundColor = .blue
}
CodePudding user response:
UITableView.appearance().backgroundColor = UIColor(named: "your set here")
CodePudding user response:
You could write a static extension for UIColor, like this:
extension UIColor {
public static let yourColor = // ... define any color here
}
You can then access this value from anywhere within your app just like the pre-defined colors (e.g. .blue
, but instead of blue you use your custom name).