Picker
Belirli tercihler arasından seçim yapmaya yarar.
SwiftUI'ın şimdiki sürümünde SegmentedPickerStyle
haricindeki stiller problemli gözüküyor.
DefaultPickerStyle
sadece Form
içinde bulunurken çalışıyor. (Formun da NavigationView içinde olması gerekiyor.)
@State var options = (1...4).map { "Option - \($0)" }
@State var selectedOption: String = "Option - 1"
NavigationView {
Form {
Picker(selection: $selectedOption, label: Text("Select an option")) {
ForEach(self.options, id: \.self) {
Text($0)
}
}.pickerStyle(SegmentedPickerStyle())
Picker(selection: $selectedOption, label: Text("Select an option")) {
ForEach(self.options, id: \.self) {
Text($0)
}
}.pickerStyle(WheelPickerStyle())
Picker(selection: $selectedOption, label: Text("Select an option")) {
ForEach(self.options, id: \.self) {
Text($0)
}
}.pickerStyle(DefaultPickerStyle())
}.padding()
}

Last updated
Was this helpful?