A simple Checkbox
SimpleCheckbox aims to accomplish what other ios checkbox controls haven't. To be simple. There's no animations, no IBDesignable to slow down interface builder, and no performance heavy draw methods.
📒 Documentation
⚖️ Carefully tuned default values.
Just drag Checkbox.swift into your project to start using it.
github "BeauNouvelle/SimpleCheckbox"to your
Cartfile.
You can learn more about Carthage and get help setting it up here.
SimpleCheckboxto your pod file.
import SimpleCheckboxto the top of your files in where you wish to use it.
https://github.com/BeauNouvelle/SimpleCheckbox.gitto your package file.
You can create a new Checkbox either programatically:
swift let checkbox = Checkbox(frame: CGRect(x: 50, y: 50, width: 25, height: 25))Or using interface builder by dragging a
UIViewinto your view controller and assigning its class to
Checkbox.
After hooking up an outlet you can begin customization.
checkbox.checkedBorderColor = .blue checkbox.uncheckedBorderColor = .black
checkbox.borderStyle = .circle checkbox.borderStyle = .square
checkbox.checkmarkColor = .blue
checkbox.checkmarkStyle = .circle checkbox.checkmarkStyle = .square checkbox.checkmarkStyle = .cross checkbox.checkmarkStyle = .tick
checkbox.useHapticFeedback = true
There are two methods for detecting when a tap event has occured and the
isCheckedproperty has changed.
checkbox.addTarget(self, action: #selector(checkboxValueChanged(sender:)), for: .valueChanged).......
@objc func checkboxValueChanged(sender: Checkbox) { print("checkbox value change: (sender.isChecked)") }
checkbox.valueChanged = { (isChecked) in print("checkbox is checked: \(isChecked)") }
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
I'm unable to continue supporting cocoapods with this project as I no longer have access the email account that was registered with this pod. All attempts to contact the cocoapods team to claim SimpleCheckbox pod have been ignored.