BeauNouvelle/SimpleCheckbox
A simple Checkbox
Border
Border Color
checkbox.checkedBorderColor = .blue
checkbox.uncheckedBorderColor = .blackBorder Style
checkbox.borderStyle = .circle
checkbox.borderStyle = .squareCheckmark
Checkmark Color
checkbox.checkmarkColor = .blueCheckmark Style
checkbox.checkmarkStyle = .circle
checkbox.checkmarkStyle = .square
checkbox.checkmarkStyle = .cross
checkbox.checkmarkStyle = .tickEmoji
checkbox.emoji = "❌"NOTE: Setting the emoji value will cause simple checkbox to ignore the checkmarkStyle. Any string will work, but only 1-3 characters may be displayed.
Haptic Feedback
checkbox.useHapticFeedback = trueEvents
There are two methods for detecting when a tap event has occured and the isChecked property has changed.
Add Target
checkbox.addTarget(self, action: #selector(checkboxValueChanged(sender:)), for: .valueChanged)
.......
@objc func checkboxValueChanged(sender: Checkbox) {
print("checkbox value change: \(sender.isChecked)")
}Closure
checkbox.valueChanged = { (isChecked) in
print("checkbox is checked: \(isChecked)")
}Touch Area
Checkboxs can sometimes appear smaller than their UIButton and UISwitch counterparts which can make them difficult to activate.
SimpleCheckbox has a way for you to tune the touch raduis to extend beyond its frame. Setting increasedTouchRadius will increase the touch radius by that amount.
checkbox.increasedTouchRadius = 5 // Default🎩 Fancy Alternatives
Package Metadata
Repository: BeauNouvelle/SimpleCheckbox
Stars: 327
Forks: 73
Open issues: 1
Default branch: master
Primary language: swift
License: MIT
Topics: carthage, checkbox, checkmark, cocoapods, hacktoberfest, interface-builder, ios, swift, uicontrol
README: README.md