BPKSwitch

public struct BPKSwitch<Content> : View where Content : View

A control that toggles between on and off states.

You create a switch by providing an isOn binding and a label. Bind isOn to a Boolean property that determines whether the switch is on or off. Set the label to a view that visually describes the purpose of switching between toggle states

  • Creates a switch that generates its label from a string.

    This initializer creates a BPKText view on your behalf, and treats the title similar to BPKText/init(_:).

    Declaration

    Swift

    public init(isOn: Binding<Bool>, text: String) where Content == BPKText

    Parameters

    isOn

    A binding to a property that indicates whether the switch is on or off.

    text

    A string that describes the purpose of the switch.

  • Creates a switch that displays a custom label.

    Declaration

    Swift

    public init(isOn: Binding<Bool>, @ViewBuilder content: () -> Content)

    Parameters

    isOn

    A binding to a property that determines whether the switch is on or off.

    content

    A view that describes the purpose of the switch.

  • Declaration

    Swift

    public var body: some View { get }