Apple Watch SwiftUI layouts
Explore SwiftUI APIs, components, and modifiers with interactive Apple Watch previews, Swift code, and Apple documentation.
30elements
Toggle
SwitchToggleStyle
A toggle style that displays a leading label and a trailing switch.
Explore SwitchToggleStyle on Apple Watch, with SwiftUI code and Apple API documentation.
SwiftUI code
@State var isOn = false
var body: some View {
List {
Toggle("Foo1", isOn: $isOn)
Toggle("Foo2", image: .cats24X24, isOn: $isOn)
Toggle("Foo3", systemImage: "star", isOn: $isOn)
Toggle(isOn: $isOn) {
Label("Foo4", systemImage: "star")
Text("Bar")
}
Toggle("Foo5", isOn: .constant(true))
}
.toggleStyle(.switch)
}Compatibility
iOS 13.0+ iPadOS 13.0+ macOS 10.15+ watchOS 6.0+ tvOS 18.0+ visionOS 1.0+
Tags
Found an issue or have a suggestion?
All variants
Every available Apple Watch screenshot for SwitchToggleStyle.