Interactive previews iPhone
Multiple Sources Toggle
Creates a toggle that updates the selected property for all sources. Once toggled, all sources will have the same value.
Platform Compatibility
iOS 16.0+ iPadOS 16.0+ macOS 13.0+ watchOS 9.0+ tvOS 16.0+ visionOS 1.0+
Tags
SwiftUI Code
struct Cat: Identifiable {
let id = UUID()
var name: String
var isHungry: Bool
}
@State private var sources = [
Cat(name: "Bella", isHungry: false),
Cat(name: "Max", isHungry: true)
]
var body: some View {
List {
Toggle("Foo1", sources: $sources, isOn: \.isHungry)
ForEach(sources) { pet in
Text("\(pet.name): \(pet.isHungry ? "😾" : "😻")")
}
}
}Found an issue or have a suggestion?
Created: July 5, 2026Updated: July 5, 2026
More Toggle Components
View allExplore Other Components
Browse allCustom Group Subscription Store View
Creates a SubscriptionStoreView with custom grouping.
Split Arrangement Layout Ratio
Sets the preferred size ratio for an arrangement view in a split style. Use this modifier when you want to customize the size of the view compared to its other views in the split layout.
LargeProductViewStyle
A style for a product view that’s suitable for layouts where the in-app purchase content is prominent.
Custom Session Async URL Image
A modifier that adds a URL session for asynchronous images contained in the view to use when fetching image data.
SliderTickContentForEach
A type of slider content that creates content by iterating over a collection.