StructDataRepresentable

protocol StructDataRepresentable : AutomationValue, Hashable
extension StructDataRepresentable : Equatable, Sendable

Serializable abstraction for Structure data objects.

  • Creates a new Struct instance using data read from the given TraitDecoder.

    Throws

    HomeError.parseError when parsing fails.

    Declaration

    Swift

    init(decoder: TraitDecoder) throws

    Parameters

    decoder

    The raw data representing this Struct.

  • Writes this Struct to the given TraitEncoder. Throws HomeError.parseError if the data could not be encoded.

    Declaration

    Swift

    func encode(with encoder: TraitEncoder) throws
  • structField(id:)

    Default implementation

    Returns the field corresponding to the given field ID.

    Default Implementation

    Returns the field corresponding to the given field ID.

    Declaration

    Swift

    static func structField(id: UInt32) -> (any Field)?
  • init(fields:)

    Default implementation

    Creates a new Struct instance using the given dictionary of field/value pairs.

    Default Implementation

    Creates a new Struct instance using the given dictionary of field/value pairs.

    Declaration

    Swift

    @_spi(Unknown)
    init?(fields: [AnyField : AnyAutomationValue])

    Parameters

    fields

    The list of fields representing this Struct.

  • toFields()

    Default implementation

    Serializes this Struct to a dictionary of AnyField/AnyAutomationValue pairs that can be used for serialization in the Automation SDK.

    Default Implementation

    Serializes this Struct to a dictionary of AnyField/AnyAutomationValue pairs that can be used for serialization in the Automation SDK.

    Declaration

    Swift

    @_spi(Unknown)
    func toFields() -> [AnyField : AnyAutomationValue]
  • isEqual(to:)

    Extension method

    Undocumented

    Declaration

    Swift

    func isEqual(to other: any StructDataRepresentable) -> Bool