I am writing a picker and it lists a bunch of icons.
Picker("Icons ", selection: $selectedIcon) {
ForEach(icons, id: \.self) { icon in
HStack {
Image(systemName: icon)
.foregroundColor(Color.red) // This doesn't work
}.padding()
}
}
In the above code, SwiftUI picker doesn't change the color of the icon to red in the picker's menu-item as per foreground color. Any idea how to change color of an image within picker menu-item?
CodePudding user response:
try using .foregroundStyle(.red, .blue)
,
works for me.