Skip to content

MagFer/SwiftCheckBox

Repository files navigation

SwiftCheckBox

Logo

[![CI Status](https://img.shields.io/travis/Ian Magarzo/SwiftCheckBox.svg?style=flat)](https://travis-ci.org/Ian Magarzo/SwiftCheckBox) Version License Platform

Example

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

Requirements

  • iOS 8.0+
  • Xcode 11+
  • Swift 5.0+

Installation

SwiftCheckBox is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SwiftCheckBox'

How to use

The checkbox button can be added programmatically

import SwiftCheckBox

let button = CheckBoxButton(frame: CGRect(x: 100, y: 100, width: 80, height: 80))
let label = UILabel(frame: button.frame.applying(CGAffineTransform(translationX: 0, y: 30.0)))
button.selectedBlock = { label.text = $0 ? "selected" : "unselected" }
view.addSubview(button)
view.addSubview(label)

or via storyboard as a custom button

  1. Add UIButton to the canvas
  2. Change class to CheckBoxButton and Module to SwiftCheckBox

UIButton subclass added

  1. Navigate to atributes and change Type to Custom

UIButton type

Author

Ian Magarzo, [email protected]

License

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

About

A checkbox framework for Swift

Resources

License

Stars

Watchers

Forks

Packages

No packages published