Skip to content
Simple customizable closure-based checkbox control written on Swift
Swift Objective-C C
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
VKCheckboxExample-ObjC
VKCheckboxExample
.gitignore
Demo.gif
LICENSE
README.md
VKCheckbox.swift

README.md

VKCheckbox

Description

VKCheckbox is a simple customizable closure-based checkbox control written on Swift

VKCheckbox Demo

Installation

For now you can install VKCheckbox manually only. Just add class VKCheckbox.swift folder into your project.

Example project

Example project shows how you can create both basic and custom VKCheckbox in one controller. To test it it, clone the repo and run it from the VKCheckboxExample directory.

Usage

Here is an example of custom round checkbox initialization:

// Customized checkbox
customCheckbox.line             = .thin
customCheckbox.bgColorSelected  = UIColor(red: 46/255, green: 119/255, blue: 217/255, alpha: 1)
customCheckbox.bgColor          = UIColor.gray
customCheckbox.color            = UIColor.white
customCheckbox.borderColor      = UIColor.white
customCheckbox.borderWidth      = 2
customCheckbox.cornerRadius     = customCheckbox.frame.height / 2

// Handle state update
customCheckbox.checkboxValueChangedBlock = {
	isOn in
	print("Custom checkbox is \(isOn ? "ON" : "OFF")")
}

Work of VKCheckbox is similliar to UISwitch. You can make it selected using next functions:

// Change state
func setOn(_ on: Bool)
func setOn(_ on: Bool, animated: Bool)

// Also you can check current state with new function
var isOn: Bool

Author

Vladislav Kovalyov, http://woopss.com/

License

VKCheckbox is available under the MIT License. See the LICENSE file for more info.

You can’t perform that action at this time.