CreationKit Documentation

Class Checkbox​Action​Layout

public final class CheckboxActionLayout: NSObject, ComponentLayout  

A layout that contains a Checkbox and a label.

You can use this layout for places that require a checkbox and some text to the right of the checkbox.

You can access the label via the label property if need be. You can access the checkbox via thecheckbox property. There is a text property so that you can easily set the text.

If you set the labelTapAction property to a non-nil value, that closure will be called when the label is tapped. If the value of this property is nil, tapping the label will toggle the checkbox.

Example

let action = Component<CheckboxActionLayout>.make()
action.layout.text = "Hide this screen for 2 weeks"
// set constraints, the checkbox inside this layout will always render at 44 points wide.
// you should ensure that the height of this layout is at least 44 points tall.
CheckboxActionLayout CheckboxActionLayout NSObject NSObject CheckboxActionLayout->NSObject ComponentLayout ComponentLayout CheckboxActionLayout->ComponentLayout

Conforms To

ComponentLayout

A protocol to share components (view layouts) across different types.

NSObject

Properties

checkbox

public private(set) var checkbox: Checkbox  

label

public private(set) var label: UILabel  

attributed​Text

public var attributedText: NSAttributedString? = nil  

text

public var text: String = ""  

alignment

public var alignment: UIStackView.Alignment = .center  

is​Multiline

public var isMultiline: Bool = false  

label​Tap​Action

public var labelTapAction: (() -> Void)? 

Methods

layout(on:​)

public func layout(on view: UIView)