Contents

init(_:isOn:action:valueLabel:)

Creates a toggle template for a control.

Declaration

@MainActor @preconcurrency init(_ titleKey: LocalizedStringKey, isOn: Bool, action: Action, @ViewBuilder valueLabel: @escaping (Bool) -> ValueLabel) where Action : SetValueIntent, Action.ValueType == Bool

Parameters

  • titleKey:

    The key to a localized 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.

See Also

Initializers