Picker

Overview

Subjects

.tag

Date-Time

Sources

.pickerStyle()

Wheel

.pickerStyle(WheelPickerStyle())

Source: Medium / Sarah / Wheel Picker View in SwiftUI,

Horizontal

Vertical

Segmented

Sample Codes

Example 1

struct ContentView: View {
    let students = ["Harry", "Hermione", "Ron"]
    @State private var selectedStudent = "Harry"

    var body: some View {
        NavigationView {
            Form {
                Picker("Select your student", selection: $selectedStudent) {
                    ForEach(students, id: \.self) {
                        Text($0)
                    }
                }
            }
        }
    }
}

Sources

Videos

Articles / Documents

See Also

Last updated