CreationKit Documentation

Class Checkbox

public final class Checkbox: UIControl  

A checkbox view that can be toggled on or off.

The designs show the checkbox at 16 points, however the HIGs recommends at least 44 points for controls. Instances of Checkbox should be with a height and width of at least points to conform to HIGS. The internal checkbox layout will always be rendered at 16pt.

Normal constructors, init(frame:), are not available for this type. Please use make instead.

  • Tag: Checkbox

Checkbox Checkbox UIControl UIControl Checkbox->UIControl

Conforms To

UIControl

Properties

is​On

@Published public var isOn: Bool = false

True if the checkbox is set to on, otherwise false.

You can programmatically set the state of the checkbox by toggling this property. This will send a valueChanged action to the control if you wish to react on any changes.

You may either react to this via it's Publisher, or the action.

Example

$isOn - Published.Publisher Usage

let checkbox = Checkbox.make()
checkbox.$isOn
  .sink { value in /* value is the new state of the checkbox */ }
  .store(in: $subscriptions)

toggles​OnTap

public var togglesOnTap: Bool = true

Set to true if you want the checkbox to update on tap, otherwise set to false. Default is true.

You can use isOn to programmatically change the state fo the checkbox.

component

public private(set) var component: Component<CheckboxLayout>  

The component that holds the CheckBoxLayout.

Methods

make(is​On:​)

public static func make(isOn: Bool = false) -> Checkbox  

Creates a new Checkbox

  • Tag: make