Class
CheckboxActionLayout
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.
Relationships
Conforms To
ComponentLayout
A protocol to share components (view layouts) across different types.
NSObject
Properties
label
public private(set) var label: UILabel
attributedText
public var attributedText: NSAttributedString? = nil
text
public var text: String = ""
alignment
public var alignment: UIStackView.Alignment = .center
isMultiline
public var isMultiline: Bool = false
labelTapAction
public var labelTapAction: (() -> Void)?
Methods
layout(on:)
public func layout(on view: UIView)