Custom Value Label Picker
Creates a picker that generates its label from a localized string key and accepts a custom current value label.
Platform Compatibility
Tags
SwiftUI Code
@State var selection = "1"
let pickerOptions = ["1", "2", "3"]
var body: some View {
List {
Picker("Foo", selection: $selection) {
ForEach(pickerOptions, id: \.self) { option in
Text(option)
}
} currentValueLabel: {
Text("Current: \(selection)")
}
}
}