Closed deskside closed 1 year ago
In SwiftUI you can render a palette image by using the .palette rendering mode followed by a foreground style containing one, two, or three colors:
Image(systemName: "person.3.sequence.fill")
.symbolRenderingMode(.palette)
.foregroundStyle(.red, .green, .blue)
Show different SF symbol by tapping the button.
@State private var showingAlerts = true
Toggle(isOn: $showingAlerts) {
Label("Show Alerts", systemImage: "bell")
.symbolVariant(showingAlerts ? .none : .slash)
}
.toggleStyle(.button)
It turns out that swiftUI comes with a Lable
consisting of a SF symbol with a title.
Label("Lightning", systemImage: "bolt.fill")
To render multicolor sf symbol:
Reference: 史上最全的SF Symbols 使用指南