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

Accepted Reply

Just use the new initialiser for Image like this:

Image(systemName: "wifi", variableValue: 0.5)
Add a Comment

Replies

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

  • I mean...variable colors...The SF Symbol's variable color

  • I know how to change sf colors but not variable colors its in WWDC

Add a Comment

Just use the new initialiser for Image like this:

Image(systemName: "wifi", variableValue: 0.5)
Add a Comment