init(_:isOn:action:valueLabel:)
Creates a toggle template for a control.
Declaration
@MainActor @preconcurrency init(_ title: some StringProtocol, isOn: Bool, action: Action, @ViewBuilder valueLabel: @escaping (Bool) -> ValueLabel) where Action : SetValueIntent, Action.ValueType == BoolParameters
- title:
A string to display as the title of the toggle.
- isOn:
A boolean value that describes the current value of the toggle.
- action:
The action the toggle performs when pressed.
- valueLabel:
A view that renders the toggle’s value. The boolean parameter represents the value.