CheckboxButton
CheckboxButton copied to clipboard
A checkbox button UI component for iOS built with Swift
CheckboxButton
A checkbox button UI component for iOS built with Swift.

CheckboxButton
- A subclass of
UIControl. The container will fit the frame of the control while maintaining its aspect ratio.
Installation
This project can be installed in different ways:
- Manual
- Download the project
- Simply copy
CheckboxButton.swiftto your project
- Framework
- Download the project
- Build the CheckboxButton framework
- Embed the framework into your project
- Carthage
- Add
github "chrisamanse/CheckboxButton"in your Cartfile
- Add
Usage
CheckboxButton can be used in two different ways:
- Interface Builder
- Simply change the class of the
UIViewtoCheckboxButton.
- Simply change the class of the
- Code
- Use the initializer:
init(frame: CGRect)
- Use the initializer:
You can run the example app located in the same project to see how it's used.
Toggle
CheckboxButton will be toggled when a .TouchedUpInside event occurred. You can observe changes in state using the UIControlEvents.ValueChanged event.
You can check if the checkbox is toggled by reading the on property. You can also set this property to programmatically set the state of the checkbox.
if checkbox.on {
print("Checkbox is checked")
}
// Toggle
checkbox.on = false // Set to false to uncheck
License
Copyright (c) 2018 Joe Christopher Paul Amanse
This software is distributed under the MIT License.