GDCheckbox
  • September 10, 2023

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

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
}

GitHub


View Github

#checkbox #ios #swift #switch
YOU MIGHT ALSO LIKE...
exyte

     

camerakit-ios

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service ...

HybridCamera

[video width="192" height="416" mp4="https://swiftgit.com/wp-content/uploads/2024/12/68747470733a2f2f7261776769742e636f6d2f7374796c656b69742f696d672f6d61737465722f7669645f6564697465645f325f326d622e676966.mp4"][/video]

TakeASelfie

An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front ...

iOS-Depth-Sampler

Code examples of Depth APIs in iOS