iPhone SwiftUI layouts

Explore SwiftUI APIs, components, and modifiers with interactive iPhone previews, Swift code, and Apple documentation. Compare every available orientation, appearance, and design.

Picker

Custom Value Label Picker

Creates a picker that generates its label from a localized string key and accepts a custom current value label.

Explore Custom Value Label Picker on iPhone in portrait, with SwiftUI code and Apple API documentation.

@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)")
        }
    }
}
iOS 18.0+ iPadOS 18.0+ macOS 15.0+ watchOS 11.0+ tvOS 18.0+ visionOS 2.0+

Every available iPhone screenshot for Custom Value Label Picker.

2 views