Contents

init(isOn:action:label:)

Creates a toggle template for a control.

Declaration

@MainActor @preconcurrency init(isOn: Bool, action: Action, @ViewBuilder label: @escaping () -> Label) where ValueLabel == ControlWidgetToggleDefaultLabel, Action : SetValueIntent, Action.ValueType == Bool

Parameters

  • 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.

Discussion

The toggle will use “On” and “Off” as default value label.

See Also

Initializers