SwitchToggleStyle

A toggle style that displays a leading label and a trailing switch.

StructureiOS 13.0+macOS 10.15+tvOS 18.0+watchOS 6.0+SwitchToggleStyle in SwiftUI

Declaration

React
type SwitchToggleStyle = SwiftOpaque<'SwitchToggleStyle'>;
Swift
nonisolated struct SwitchToggleStyle

Overview

Use the ToggleStyle.switch static variable to create this style:

Toggle("Enhance Sound", isOn: $isEnhanced)
    .toggleStyle(.switch)

From Apple’s SwiftUI documentation. Code samples there are Swift.

See also

More in Styles.