iPhone SwiftUI layouts

Explore interactive SwiftUI previews across every available iPhone screenshot variant.

Picker

Multiple Sources Picker

Creates a picker that updates the selected property for all sources.

enum SpecialProperty: String, CaseIterable, Identifiable {
    case small, medium, large
    var id: String { rawValue }
}

struct Cat: Identifiable {
    let id = UUID()
    var name: String
    var size: SpecialProperty
}

@State private var sources = [
    Cat(name: "Bella", size: .small),
    Cat(name: "Max", size: .large)
]

var body: some View {
    List {
        Picker("Size for all pets", sources: $sources, selection: \.size) {
            ForEach(SpecialProperty.allCases) { size in
                Text(size.rawValue).tag(size)
            }
        }

        ForEach(sources) { pet in
            Text("\(pet.name): \(pet.size.rawValue)")
        }
    }
}
iOS 16.0+ iPadOS 16.0+ macOS 13.0+ watchOS 9.0+ tvOS 16.0+ visionOS 1.0+

Every available iPhone screenshot for Multiple Sources Picker.

2 views