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