Skip to content

Toggles

Nick Sarno edited this page Apr 14, 2022 · 1 revision

CustomToggle

Highly customizable Toggle.

@State private var isOn: Bool = false
var body: some View {
     CustomToggle(isOn: $isOn)
}

Customize with optional parameters.

CustomToggle(isOn: $isOn, width: 100, pinColor: .gray, backgroundColor: .black, haptic: .selection)

Easily animate colors.

CustomToggle(isOn: $isOn, pinColor: .white, backgroundColor: isOn ? .green : .gray.opacity(0.3))

CustomToggle(isOn: $isOn, pinColor: isOn ? .red : .white, backgroundColor: isOn ? .blue : .gray.opacity(0.3))
Clone this wiki locally