Structure
OUDSSwitch
Switch is a UI element that allows to toggle between two states, typically “On” and “Off”, and used to enable or disable features, options or settings. Switch that does not show icon or text, provides greater flexibility when creating other components that require a Switch to be displayed.
- iOS 15.0+
- macOS 13.0+
- tvOS 16.0+
- visionOS 1.0+
- watchOS 11.0+
@MainActor struct OUDSSwitch
Mentioned In
Accessibility considerations
Note also the component must be instanciated with a string parameter used as accessibility label. It is a good pratice (at least) to define a label for a component without text for accessibility reasons. This label will be vocalized by Voice Over. The vocalization tool will also use, after the label, a description of the component (if disabled, if error context), and a fake trait for switch.
Cases forbidden by design
The design system does not allow to have both a read only situation and a disabled component.
Code samples
// Supposing we have an unselected state
@Published var isOn: Bool = false
// A simple switch, no error, not in read only mode
OUDSSwitch(isOn: $isOn, accessibilityLabel: "The cake is a lie")
Design documentation
unified-design-system.orange.com
Themes rendering
Orange

Orange Compact

Sosh

Wireframe

Version
1.5.0 (Figma component design version)
Since
0.14.0
Topics
Initializers
Instance Properties