import BrandUIKit
CheckmarkToggle
BrandUIKit comes included with a stylized ToggleStyle
called CheckToggleStyle()
.
.toggleStyle(CheckToggleStyle())
You can pass disabled: Bool
to block the user from editing the text field.
struct ContentView: View {
@State var isCheckedOne: Bool = false
@State var isCheckedTwo: Bool = true
var body: some View {
VStack(spacing: 20) {
Toggle("Checkmark Toggle", isOn: $isCheckedOne)
.toggleStyle(CheckToggleStyle())
.font(.largeTitle)
Toggle("Checkmark Toggle", isOn: $isCheckedTwo)
.toggleStyle(CheckToggleStyle())
.font(.largeTitle)
}
}
}
You can also use it 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.