BeauNouvelle/SimpleCheckbox
Fork: 75 Star: 325 (更新于 2024-10-27 09:09:45)
license: MIT
Language: Swift .
A simple Checkbox
最后发布版本: 2.5.1 ( 2024-01-12 16:28:33)
SimpleCheckbox aims to accomplish what other ios checkbox controls haven't. To be simple. There's no animations, no IBDesignable to slow down interface builder, and no performance heavy draw methods.
🎉 Features
📒 Documentation
⚖️ Carefully tuned default values.
✅ Requirements
- Xcode 11
- iOS 10+
- Swift 5.1
👨💻 Installation
Manual
Just drag Checkbox.swift into your project to start using it.
Carthage
- Add
github "BeauNouvelle/SimpleCheckbox"
to yourCartfile
.
You can learn more about Carthage and get help setting it up here.
Cocoapods
Podspec is present, however with SPM out for quite a while now, Cocoapods is no longer officially supported. Latest supported version of SimpleCheckbox is 2.2.2
Swift Package Manager
- Add
https://github.com/BeauNouvelle/SimpleCheckbox.git
to your package file.
👩🍳 Usage
You can create a new Checkbox either programatically:
let checkbox = Checkbox(frame: CGRect(x: 50, y: 50, width: 25, height: 25))
Or using interface builder by dragging a UIView
into your view controller and assigning its class to Checkbox
.
After hooking up an outlet you can begin customization.
👩🎨 Customization
Border
Border Color
checkbox.checkedBorderColor = .blue
checkbox.uncheckedBorderColor = .black
Border Style
checkbox.borderStyle = .circle
checkbox.borderStyle = .square
Checkmark
Checkmark Color
checkbox.checkmarkColor = .blue
Checkmark Style
checkbox.checkmarkStyle = .circle
checkbox.checkmarkStyle = .square
checkbox.checkmarkStyle = .cross
checkbox.checkmarkStyle = .tick
Emoji
checkbox.emoji = "❌"
NOTE: Setting the emoji value will cause simple checkbox to ignore the checkmarkStyle. Any string will work, but only 1-3 characters may be displayed.
Haptic Feedback
checkbox.useHapticFeedback = true
Events
There are two methods for detecting when a tap event has occured and the isChecked
property has changed.
Add Target
checkbox.addTarget(self, action: #selector(checkboxValueChanged(sender:)), for: .valueChanged)
.......
@objc func checkboxValueChanged(sender: Checkbox) {
print("checkbox value change: \(sender.isChecked)")
}
Closure
checkbox.valueChanged = { (isChecked) in
print("checkbox is checked: \(isChecked)")
}
Touch Area
Checkboxs can sometimes appear smaller than their UIButton and UISwitch counterparts which can make them difficult to activate.
SimpleCheckbox has a way for you to tune the touch raduis to extend beyond its frame. Setting increasedTouchRadius will increase the touch radius by that amount.
checkbox.increasedTouchRadius = 5 // Default
🎩 Fancy Alternatives
最近版本更新:(数据更新于 2024-09-05 12:14:45)
2024-01-12 16:28:33 2.5.1
2023-10-09 19:27:19 2.5.0
2020-10-18 09:58:31 2.2.0
主题(topics):
carthage, checkbox, checkmark, cocoapods, hacktoberfest, interface-builder, ios, swift, uicontrol
BeauNouvelle/SimpleCheckbox同语言 Swift最近更新仓库
2024-11-03 04:20:56 argmaxinc/WhisperKit
2024-11-01 03:30:19 wordpress-mobile/WordPress-iOS
2024-10-30 03:29:03 jordanbaird/Ice
2024-10-24 23:32:54 whoeevee/EeveeSpotify
2024-10-24 02:02:47 Artificial-Pancreas/iAPS
2024-10-23 00:57:58 pointfreeco/swift-composable-architecture