FieldCollector

open class FieldCollector<T> : Collector, AnyFieldCollector, Validator, @unchecked Sendable

Abstract class representing a field collector.

  • property type: The type of the field collector.
  • property key: The key of the field collector.
  • property label: The label of the field collector.
  • property id The UUID of the field collector.
  • Declaration

    Swift

    public private(set) var type: String { get }
  • key

    Declaration

    Swift

    public private(set) var key: String { get }
  • Declaration

    Swift

    public private(set) var label: String { get }
  • Declaration

    Swift

    public private(set) var required: Bool { get }
  • id

    Declaration

    Swift

    public var id: String { get }
  • Initializes a new instance of FieldCollector.

    Declaration

    Swift

    public init()
  • Initializes a new instance of FieldCollector.

    Declaration

    Swift

    required public init(with json: [String : Any])

    Parameters

    json

    The json to initialize from.

  • Initializes FieldCollector with the given value. This implementation does nothing. Subclasses should override this method as needed.

    Declaration

    Swift

    public func initialize(with value: Any)

    Parameters

    input

    The value to initialize with.

  • Validates the field collector. Returns an array of validation errors.

    Declaration

    Swift

    public func validate() -> [ValidationError]
  • Function returning the Payload of the FieldCollector.

    Declaration

    Swift

    open func payload() -> T?
  • Type-erased version of payload()

    Declaration

    Swift

    public func anyPayload() -> Any?