Hi swiftUI guys, how can I use variable color? can't find how

⬆️

Answered by BabyJ in 719020022

Just use the new initialiser for Image like this:

Image(systemName: "wifi", variableValue: 0.5)

Could you be more specific ? Do you want to change color of an SF symbol (that's what the tag hints at, but the very short explanation text shows an emoji) ? Of an emoji ? Or something else ?

To change SF Symbol:

let imageIcon = UIImage(systemName: "square.and.arrow.up")?.withTintColor(.red, renderingMode: .alwaysOriginal)
    imageView.image = imageIcon

Please, read and apply the good practices on how to post questions on the forum: https://developer.apple.com/forums/thread/706527

Accepted Answer

Just use the new initialiser for Image like this:

Image(systemName: "wifi", variableValue: 0.5)
Hi swiftUI guys, how can I use variable color? can't find how
 
 
Q