Check - Tai-Kimura/SwiftJsonUI GitHub Wiki
Check
class: SJUICheckBox inherites: UIButton
Platform Support
- ✅ UIKit: Full support (All attributes available)
- ✅ SwiftUI: Full support (Custom implementation with checkbox functionality)
Attributes for Check
| attribute name | UIKit | SwiftUI | Compose | XML | type in json | details | remarks |
|---|---|---|---|---|---|---|---|
| label | ✅ | ✅ | ✅ | ❌ | string | View id for associated label. Tap event will be set to both checkbox and label | |
| src | ✅ | ✅ | ✅ | ❌ | string | Image name for unchecked state | |
| onSrc | ✅ | ✅ | ✅ | ❌ | string | Image name for checked state | |
| checked | ✅ | ✅ | ✅ | ✅ | boolean/string | Initial checked state. Can be boolean or @{variableName} | |
| value | ✅ | ✅ | ✅ | ❌ | any | Associated value when checked | |
| onclick | ✅ | ✅ | ✅ | ❌ | string | Selector for tap event | |
| enabled | ✅ | ✅ | ✅ | ✅ | boolean/string | view.isEnabled. Can be boolean or @{variableName} | |
| tintColor | ✅ | ✅ | ✅ | ❌ | string | Tint color for checkbox images |
Properties for Check
open class var viewClass: SJUICheckBox.Type
this property will be used to decide which class to inflate with createFromJSON method. You should define the view's class on this property when you create classes inherite SJUICheckBox.
Functions for Check
public class func createFromJSON(attr: JSON, target: Any, views: inout [String: UIView]) -> SJUICheckBox
This method will be called when it's created from json file. Override This method when you create classes inherite SJUICheckBox class.