Multiple Sources Picker

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

Multiple Sources Picker - iOS Liquid Glass Light Mode Preview

Platform Compatibility

iOS 16.0+ iPadOS 16.0+ macOS 13.0+ watchOS 9.0+ tvOS 16.0+ visionOS 1.0+

Tags

SwiftUI Code

Docs
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)")
        }
    }
}

Found an issue or have a suggestion?

Created: April 4, 2026Updated: April 4, 2026