TraitAttribute

@propertyWrapper
struct TraitAttribute<Value> where Value : Sendable
extension TraitAttribute : Sendable

Property wrapper for trait attributes, which contains metadata about the attribute.

  • The attribute’s value.

    This is always an Optional to support attributes not supported by the device, either because they are optional, or because the device doesn’t comply with the matter spec.

    Declaration

    Swift

    let wrappedValue: Value?
  • Whether this attribute is supported by the device.

    This reflects whether the device reports support for this attribute (by including it in attributeList) and provides a valid value for it.

    Declaration

    Swift

    let isSupported: Bool
  • Whether the attribute is nullable in the matter spec.

    Note that it is valid for this to be false and wrappedValue to be nil, this can happen if the attribute is optional, or if the device doesn’t comply with the matter spec.

    Declaration

    Swift

    let isNullable: Bool
  • Undocumented

    Declaration

    Swift

    var projectedValue: TraitAttribute<Value> { get }
  • Undocumented

    Declaration

    Swift

    init(wrappedValue: Value?, isSupported: Bool, isNullable: Bool)