protocol DeviceType : CustomDebugStringConvertible, Hashable, Sendableextension DeviceType : EquatableProtocol implemented by all the generated DeviceType structs.
A device type represents a collection of traits with connected functionality.
-
The device type’s identifier.
Declaration
Swift
static var identifier: String { get } -
Additional information about this device type.
Declaration
Swift
var metadata: DeviceTypeMetadata { get } -
The traits that make up this device type.
Use this to access traits that are not directly exposed as properties on the
DeviceType, like custom traits and traits belonging to utility types.Declaration
Swift
var traits: TraitCollection { get } -
Entrypoint to subscribe to events on this DeviceType.
Declaration
Swift
var events: any EventController { get } -
Creates a new
DeviceTypefrom the given trait collection.Throws
Throws aHomeErrorif the given collection is missing one or more required traits for the given device type.Declaration
Swift
init(traits: TraitCollection, eventController: any EventController, metadataBuilder: ([any Trait]?) -> DeviceTypeMetadata) throws -
Extension methodidentifier
Undocumented
Declaration
Swift
var identifier: String { get } -
Extension method==(_:_:)
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values
aandb,a == bimplies thata != bisfalse.Declaration
Swift
static func == (lhs: Self, rhs: Self) -> BoolParameters
lhsA value to compare.
rhsAnother value to compare.
-
Extension methodhash(into:)
Hashes the essential components of this value by feeding them into the given hasher.
Implement this method to conform to the
Hashableprotocol. The components used for hashing must be the same as the components compared in your type’s==operator implementation. Callhasher.combine(_:)with each of these components.Important
In your implementation of
hash(into:), don’t callfinalize()on thehasherinstance provided, or replace it with a different instance. Doing so may become a compile-time error in the future.Declaration
Swift
func hash(into hasher: inout Hasher)