I found 2 unexpected (for me) behaviors of Picker in SwiftUI.
- The default style for
Pickeron iOS inside theListview seems to be.menuand it does not take any tint color at all (fair enough). However, forcing style with.pickerStyle(.menu)changes picker's color as expected… almost. - Changing the tint color of the parent's view does not have any effect on this picker.
Do you have any idea why does it happen?
Xcode 14.1 RC, iOS 16.1
struct PickerTintColorTest: View {
let colors: [Color] = [.purple, .green, .orange]
var colorList: some View {
ForEach(colors, id: \.self) { color in
Text(color.description)
}
}
@State private var selectedColor: Color = .green
var body: some View {
List {
Picker("Default style", selection: $selectedColor) { colorList } // <- doesn't have a tint color at all
Picker("Menu style", selection: $selectedColor) { colorList }
.pickerStyle(.menu) // <- forcing to .menu style gives picker a tint color BUT it doesn't update
Button("Action") { } // <- tint as expected, updates as expected
}
.tint(selectedColor)
}
}
Not initial screenshot. It's after changing picker value.

@Ryba Not sure if it's still actual for you but I faced exactly the same problem today and after I posted a question here on SO as well, I figured out a solution. The trick is to set the tint color to
.whiteand then set the desired State binding via the.colorMultiply(_ Color)modifier instead of the.tint(_ Color)modifier.So:
See my detailed answer and code snippet here: https://stackoverflow.com/a/76203813/3469410