swiftui color code example
Example 1: swift set uiimage color
extension UIImageView {
func setImageColor(color: UIColor) {
let templateImage = self.image?.withRenderingMode(.alwaysTemplate)
self.image = templateImage
self.tintColor = color
}
}
Example 2: button color swiftui
Button(action: {self.buttonTapped()}) {
Text("Button")
.padding(.all, 12)
.foregroundColor(.white)
.background(Color.red)
}
Example 3: swiftui font color
Text("The best laid plans")
.foregroundColor(Color.red)
Example 4: swiftui background color
Group {
}.background(Color.red.edgesIgnoringSafeArea(.all))
Example 5: swift set uicolor
let swiftColor = UIColor(red: 1, green: 165/255, blue: 0, alpha: 1)