Skip to content

polok/UICheckbox.Swift

Repository files navigation

Storage

Platform: iOS 8+ Language: Swift 2 CocoaPods compatible License: MIT

InstallationIssuesLicense

UICheckbox is simple as hell and lightweight class to add 'checkbox' UI component in iOS application. For now it inherits from UIButton but this probably will change in upcoming versions.

Demo

Demo UICheckbox

Compatibility

UICheckbox requires iOS 8+ and is compatible with Swift 3 projects (for Swift 2.3 support, please check swift-2.3 branch). Please, don't count for Objective-C support ;)

Installation

As for CocoaPods, use this to get the latest release:

use_frameworks!

pod 'UICheckbox.Swift'

And import UICheckbox in the files you'd like to use it.

Usage

A custom params available from Interface Builder

  • border width
    Border width of our UICheckbox
  • border color
    Border color of our UICheckbox
  • corner radius
    Radius if we don't want to have square UICheckbox
  • padding
    Padding of our UICheckbox to increase the 'touch' area (especially for smaller ones)

UICheckbox is a subclass of UIButton (at least for now), so you can add it by adding UIButton class and then just change the class to UICheckbox

Callback to be notified about UICheckbox state changes:

checkbox.onSelectStateChanged = { (checkbox, selected) in
    debugPrint("Clicked - \(selected)")
}

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Marcin Polak - mpolak87(at).gmail.com

Contribution

Feel free to fork the project and send us a pull-request! 😎

License

UICheckbox is available under the MIT license. See the LICENSE file for more info.

About

UICheckbox is simple as hell and lightweight class to add 'checkbox' UI component in iOS application

Resources

License

Stars

Watchers

Forks

Packages

No packages published