Radio - Tai-Kimura/SwiftJsonUI GitHub Wiki

Radio

class: SJUIRadioButton inherits: UIView

Platform Support

  • UIKit: Full support (All attributes available)
  • SwiftUI: Full support (Custom implementation with RadioButton view)

Attributes for Radio

attribute name UIKit SwiftUI Compose XML type in json details remarks
text string Label text for radio button
font string Font name for label
fontSize float Font size for label
fontColor string NSAttributedStringKey.foregroundColor
icon string Image name for normal state
selected_icon string Image name for selected state
group string Radio group name. Radio buttons with same group are mutually exclusive
checked boolean/string Initial checked state. Can be boolean or @{variableName}
value any Associated value when selected
onclick string Selector for tap event
enabled boolean/string view.isEnabled. Can be boolean or @{variableName}
tintColor string Tint color for radio images
spacing float Space between icon and text

Properties for Radio

open class var viewClass: SJUIRadioButton.Type

This property will be used to decide which class to instantiate with the createFromJSON method. You should define the view's class on this property when you create classes that inherit from SJUIRadioButton.

Functions for Radio

public class func createFromJSON(attr: JSON, target: Any, views: inout [String: UIView]) -> SJUIRadioButton

This method will be called when it's created from a JSON file. Override this method when you create classes that inherit from SJUIRadioButton class.