protocol Trait : TraitEncodable, CustomStringConvertible, Hashable, Sendableextension Trait : EquatableBasic interface for object Traits.
-
List of all event types on the given Trait.
Currently, only
MatterTraittraits support any events, but this will likely expand to other traits in the future.Declaration
Swift
static var supportedEventTypes: [any Event.Type] { get } -
List of all commands supported by the Trait’s definition. The commands supported by a specific Trait instance may vary.
Declaration
Swift
static var supportedCommandTypes: [any Command.Type] { get } -
Metadata about this
Trait.Declaration
Swift
var metadata: TraitMetadata { get } -
Creates a new Trait instance using data read from the given
TraitDecoder.Throws
HomeError.parseErrorwhen parsing fails.Declaration
Swift
init(decoder: TraitDecoder, interactionProxy: (any InteractionProxy)?, metadata: TraitMetadata) throwsParameters
decoderThe raw data representing this Trait.
interactionProxyProxy to the Interaction Client.
metadataMetadata about this Trait.
-
Default implementationattribute(id:)
Returns the field corresponding to the given field ID.
Default Implementation
Returns the field corresponding to the given field ID.
Declaration
Swift
static func attribute(id: UInt32) -> (any Field)? -
Extension methoddescription
Returns a string representation of the Trait as {namespace}.{traitName}.
Declaration
Swift
var description: String { get }