Switch

Switches allow users to toggle between two states, on or off. On mobile, these are often used as a replacement for checkboxes.

Backpack-SwiftUI/Switch

Cocoapods class reference view on Github

Default

Day Night

Usage

Text Switch

Use a string to set the text shown by the switch as a BPKText label

import Backpack_SwiftUI
@State var isEnabled = true

BPKSwitch(isOn: $isEnabled, text: "Enable")

Custom Switch

Use a custom View as the label of the switch

import Backpack_SwiftUI
@State var isEnabled = true

BPKSwitch(isOn: $isEnabled) {
    BPKText("Enable")
        .paddding()
}