BooleanCollector
public class BooleanCollector : FieldCollector<Bool>, @unchecked Sendable
A collector representing a single checkbox field (e.g., agreement acceptance). The value is a boolean indicating whether the checkbox is checked.
-
The appearance of the checkbox (CHECKBOX or SWITCH).
Declaration
Swift
public private(set) var appearance: BooleanCollectorAppearance { get } -
The error message to display when validation fails.
Declaration
Swift
public private(set) var errorMessage: String? { get } -
Optional rich content with template text and link replacements.
Declaration
Swift
public private(set) var richContent: RichContent? { get } -
The current checked state of the checkbox.
Declaration
Swift
public var value: Bool -
Initializes a new instance of
BooleanCollectorwith the given JSON input.Declaration
Swift
public required init(with json: [String : Any]) -
Initializes the collector with a pre-existing value.
Declaration
Swift
public override func initialize(with value: Any)Parameters
valueA boolean value to set the checkbox state.
-
Returns the boolean payload for form submission.
Declaration
Swift
override public func payload() -> Bool? -
Validates the checkbox. If required and unchecked, returns a validation error.
Declaration
Swift
public override func validate() -> [ValidationError]
View on GitHub