Checkmark Toggle Style (CheckToggleStyle()
)
You can turn any SwiftUI Toggle into a checkmark toggle by applying the CheckToggleStyle()
.
Toggle("Checkmark Toggle", isOn: $isChecked)
.toggleStyle(CheckToggleStyle())
.font(.largeTitle)
It doesn't take any arguments as inputs and is stylized using app's accent color.
You can also use the Checkmark View independently by calling CheckmarkToggle
directly.
CheckmarkToggle(checked: Bool, onToggle: @escaping (() -> Void) = {})
checked
: A boolean value to determine if the toggle is checked or not.onToggle
: A closure that is called when the checkmark is tapped.