Skip to content

A checkbox button UI component for iOS built with Swift

License

Notifications You must be signed in to change notification settings

mohzameer/CheckboxButton

 
 

Repository files navigation

CheckboxButton

Build Status Carthage compatible

A checkbox button UI component for iOS built with Swift.

CheckboxButton image

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
    1. Download the project
    2. Simply copy CheckboxButton.swift to your project
  • Framework
    1. Download the project
    2. Build the CheckboxButton framework
    3. Embed the framework into your project
  • Carthage
    1. Add github "chrisamanse/CheckboxButton" in your Cartfile

Usage

CheckboxButton can be used in two different ways:

  • Interface Builder
    • Simply change the class of the UIView to CheckboxButton.
  • Code
    • Use the initializer: init(frame: CGRect)

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.

About

A checkbox button UI component for iOS built with Swift

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 90.5%
  • Ruby 5.8%
  • Objective-C 3.7%