Customizable CheckBox / RadioButton component for iOS

Overview

GDCheckbox

An easy to use CheckBox/Radio button component for iOS, with Attributes inspector support.

untitled

Requirements

  • Xcode 10+
  • Swift 5
  • iOS 9+

Installation

Cocoapods

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'GDCheckbox'
end
pod install

Manually

Drag GDCheckbox.swift to your project!

How to use

override func viewDidLoad() {
    super.viewDidLoad()


    let checkbox: GDCheckbox = GDCheckbox()

    // Background color of the box
    checkbox.baseColor = UIColor.white

    // In case of check box, determine the animation duration of the check mark
    checkbox.animationDuration = 1.0

    // Determine if check mark should fill with animation
    checkbox.shouldAnimate = false

    // Color of the check mark / fill area -- no matter if isCurcular is on or off
    checkbox.checkColor = UIColor.red

    // Width of the check mark / fill area -- no matter if isCurcular is on or off
    checkbox.checkWidth = 3.0

    // Color of container border. If shouldFillContainer is set to true, container background also will be override with this color when CheckBox / Radio Button is selected.
    checkbox.containerColor = UIColor.blue

    // Determine if container should be filled when selected
    // Note: if set to true, it will override `baseColor` when control is selected
    checkbox.shouldFillContainer = false

    // Border width of container view
    checkbox.containerWidth = 5.0

    // Determine if it's a check box or a radio button
    checkbox.isRadioButton = false
    
    // Determine container shpae type for selected state
    // For CheckBox -> Check mark when true or square when false
    // For RadioButton -> Check mark when true or circle when false
    checkbox.showCheckMark = false

    // Set default state of the control
    checkbox.isOn = false
    
    self.view.addSubview(checkbox)
}

@IBAction func onCheckBoxPress(_ sender: GDCheckbox) {
    let state = sender.isOn ? "ON" : "OFF"
    // Trigger action
}
You might also like...
A simple, customizable view for efficiently collecting country information in iOS apps.
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

A customizable color picker for iOS in Swift
A customizable color picker for iOS in Swift

IGColorPicker is a fantastic color picker 🎨 written in Swift. Table of Contents Documentation Colors Style Other features Installation Example Gettin

Modular and customizable Material Design UI components for iOS
Modular and customizable Material Design UI components for iOS

Material Components for iOS Material Components for iOS (MDC-iOS) helps developers execute Material Design. Developed by a core team of engineers and

Simple and highly customizable iOS tag list view, in Swift.
Simple and highly customizable iOS tag list view, in Swift.

TagListView Simple and highly customizable iOS tag list view, in Swift. Supports Storyboard, Auto Layout, and @IBDesignable. Usage The most convenient

A minimalistic looking banner library for iOS. It supports multiple customizable kinds of Banner types
A minimalistic looking banner library for iOS. It supports multiple customizable kinds of Banner types

A minimalistic looking banner library for iOS. It supports multiple customizable kinds of Banner types

📊 A customizable gradient progress bar (UIProgressView).
📊 A customizable gradient progress bar (UIProgressView).

GradientProgressBar A customizable gradient progress bar (UIProgressView). Inspired by iOS 7 Progress Bar from Codepen. Example To run the example pro

Highly customizable Action Sheet Controller with Assets Preview written in Swift
Highly customizable Action Sheet Controller with Assets Preview written in Swift

PPAssetsActionController Play with me ▶️ 🖐 If you want to play with me, just tap here and enjoy! 🎩 🕴 Show me 🎪 Try me 📲 The easiest way to try me

RangeSeedSlider provides a customizable range slider like a UISlider.
RangeSeedSlider provides a customizable range slider like a UISlider.

RangeSeekSlider Overview RangeSeekSlider provides a customizable range slider like a UISlider. This library is based on TomThorpe/TTRangeSlider (Objec

Customizable School Timetable Library
Customizable School Timetable Library

JHTimeTable SwiftUI Customizable School TimeTable Library 설치 Swift Package Manager 사용하기 JHTimeTable뷰를 선언합니다. JHTimeTable(lineColor : .secondary,

Comments
  • Invalid numeric value problem

    Invalid numeric value problem

    Hi, thank you for such a library. I faced such a problem while adding dynamic checkboxes inside collection view cells. Can you update library with fixing this problem? [Unknown process name] Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem. [Unknown process name] Backtrace: <CGFloatValidateWithLog+57> <CGPathAddLineToPoint+82> <-[UIBezierPath addLineToPoint:]+27> <_T012lunchify_ios10GDCheckboxC9checkPath33_1F02B49C182E85D24E82DDAF7B5316CBLLSo08UIBezierE0Cfg+1998> <_T012lunchify_ios10GDCheckboxC10drawLayers33_1F02B49C182E85D24E82DDAF7B5316CBLLyyF+716> <_T012lunchify_ios10GDCheckboxC18initializeCheckbox33_1F02B49C182E85D24E82DDAF7B5316CBLLyyF+174> <_T012lunchify_ios10GDCheckboxCACSC6CGRectV5frame_tcfc+1470> <_T012lunchify_ios10GDCheckboxCACSC6CGRectV5frame_tcfcTo+38> <-[UIView init]+62> <_T0So9UIControlCABycfcTO+19> <_T0So9UIControlCABycfC+60>

    opened by kerimovscreations 4
  • Checkbox Click Delay

    Checkbox Click Delay

    There is a litte delay in click till it actually work , test that by clicking the checkbox fast and it wont act ( check state wont change) but sliding on it or holding it for sometime > 1s is working but pressing fast like a normal press for any touch input is not changing the checkbox state

    opened by Mahan3340 3
Owner
Saeid
iOS Developer
Saeid
UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

Mohsan Khan 29 Sep 9, 2022
A panel component similar to the iOS Airpod battery panel or the Share Wi-Fi password panel.

A SwiftUI panel component similar to the iOS Airpod battery panel or the Share Wi-Fi password panel.

Red Davis 12 Feb 7, 2022
AGCircularPicker is helpful component for creating a controller aimed to manage any calculated parameter

We are pleased to offer you our new free lightweight plugin named AGCircularPicker. AGCircularPicker is helpful for creating a controller aimed to man

Agilie Team 617 Dec 19, 2022
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version

ContainerController UI Component. This is a copy swipe-panel from app: https://www.apple.com/ios/maps/ Preview Requirements Installation CocoaPods Swi

Rustam 419 Dec 12, 2022
Zeplin component preview for your SwiftUI views

A Zeplin component preview for your SwiftUI views. You can use Zeplin components instead of real views within your app until you implement them.

Danis Tazetdinov 4 Sep 1, 2022
⬆️ A SwiftUI view component sliding in from bottom

⬆️ A SwiftUI view component sliding in from bottom

Tieda 595 Dec 28, 2022
A multi-platform SwiftUI component for tabular data

SwiftTabler A multi-platform SwiftUI component for tabular data. NOTE this component is BRAND NEW and under active development. If you need stability,

OpenAlloc 45 Jan 3, 2023
TSnackBarView is a simple and flexible UI component fully written in Swift

TSnackBarView is a simple and flexible UI component fully written in Swift. TSnackBarView helps you to show snackbar easily with 3 styles: normal, successful and error

Nguyen Duc Thinh 3 Aug 22, 2022
TDetailBoxView is a simple and flexible UI component fully written in Swift

TDetailBoxView is a simple and flexible UI component fully written in Swift. TDetailBoxView is developed to help users quickly display the detail screen without having to develop from scratch.

Nguyen Duc Thinh 2 Aug 18, 2022
TSwitchLabel is a simple and flexible UI component fully written in Swift.

TSwitchLabel is a simple and flexible UI component fully written in Swift. TSwitchLabel is developed for you to easily use when you need to design a UI with Label and Switch in the fastest way without having to spend time on develop from scratch.

Nguyen Duc Thinh 2 Aug 18, 2022