# TraitController

    protocol TraitController : Sendable

Controller for accessing traits on an object.
- `


  ### [contains(_:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/TraitController#/s:13GoogleHomeSDK15TraitControllerP8containsySbqd__mAA0D0Rd__lF)


  ` Returns `true` if this `TraitController` includes the specified `https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Trait.html`.

  #### Declaration

  Swift

      func contains<T>(_ type: T.Type) -> Bool where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Trait.html

- `


  ### [get(_:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/TraitController#/s:13GoogleHomeSDK15TraitControllerP3getyqd__Sgqd__mYaAA0D0Rd__lF)


  ` Returns an instance of the specified `https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Trait.html` if it is supported, nil otherwise.

  This is a convenience method that returns the first value published by the `subscribe` API.

  #### Declaration

  Swift

      func get<T>(_ type: T.Type) async -> T? where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Trait.html

- `


  ### [subscribe(_:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/TraitController#/s:13GoogleHomeSDK15TraitControllerP9subscribey7Combine12AnyPublisherVyqd__AA0B5ErrorVGqd__mAA0D0Rd__lF)


  ` Subscribes to a trait of the specified type.

  #### Declaration

  Swift

      func subscribe<T>(_ type: T.Type) -> AnyPublisher<T, https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/HomeError.html> where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Trait.html