# TraitDecoder

    struct TraitDecoder

Public interface for decoding Trait data.
- `


  ### [traitPayload](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV12traitPayloadAA0dG0VSgvp)


  ` Undocumented

  #### Declaration

  Swift

      @_spi(Unknown)
      var traitPayload: https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitPayload.html? { get }

- `


  ### [init(payload:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV7payloadAcA0D7PayloadV_tKcfc)


  ` Undocumented

  #### Declaration

  Swift

      @_spi(Unknown)
      init(payload: https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitPayload.html) throws

- `


  ### [unwrapPayload(namespace:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV13unwrapPayload9namespaceACSays6UInt32VG_tKF)


  ` Undocumented

  #### Declaration

  Swift

      func unwrapPayload(namespace: [UInt32]) throws -> TraitDecoder

- `


  ### [decode(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV6decode3tag4typexs6UInt32V_xmtKAA6ScalarRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decode<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> T where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK6ScalarP

- `


  ### [decodeArray(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV11decodeArray3tag4typeSayxGs6UInt32V_xmtKAA6ScalarRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeArray<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> [T] where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK6ScalarP

- `


  ### [decodeOptional(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV14decodeOptional3tag4typexSgs6UInt32V_xmtKAA6ScalarRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeOptional<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> T? where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK6ScalarP

- `


  ### [decodeOptionalArray(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV19decodeOptionalArray3tag4typeSayxGSgs6UInt32V_xmtKAA6ScalarRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeOptionalArray<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> [T]? where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK6ScalarP

- `


  ### [decode(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV6decode3tag4typexs6UInt32V_xmtKAA6BitmapRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decode<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> T where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Bitmap.html

- `


  ### [decodeArray(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV11decodeArray3tag4typeSayxGs6UInt32V_xmtKAA6BitmapRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeArray<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> [T] where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Bitmap.html

- `


  ### [decodeOptional(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV14decodeOptional3tag4typexSgs6UInt32V_xmtKAA6BitmapRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeOptional<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> T? where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Bitmap.html

- `


  ### [decodeOptionalArray(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV19decodeOptionalArray3tag4typeSayxGSgs6UInt32V_xmtKAA6BitmapRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeOptionalArray<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> [T]? where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Bitmap.html

- `


  ### [decode(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV6decode3tag4typexs6UInt32V_xmtKAA4EnumRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decode<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> T where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Enum.html

- `


  ### [decodeArray(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV11decodeArray3tag4typeSayxGs6UInt32V_xmtKAA4EnumRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeArray<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> [T] where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Enum.html

- `


  ### [decodeOptional(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV14decodeOptional3tag4typexSgs6UInt32V_xmtKAA4EnumRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeOptional<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> T? where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Enum.html

- `


  ### [decodeOptionalArray(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV19decodeOptionalArray3tag4typeSayxGSgs6UInt32V_xmtKAA4EnumRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeOptionalArray<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> [T]? where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Enum.html

- `


  ### [decode(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV6decode3tag4typexs6UInt32V_xmtKAA23StructDataRepresentableRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decode<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> T where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/StructDataRepresentable.html

- `


  ### [decodeArray(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV11decodeArray3tag4typeSayxGs6UInt32V_xmtKAA23StructDataRepresentableRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeArray<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> [T] where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/StructDataRepresentable.html

- `


  ### [decodeOptional(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV14decodeOptional3tag4typexSgs6UInt32V_xmtKAA23StructDataRepresentableRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeOptional<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> T? where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/StructDataRepresentable.html

- `


  ### [decodeOptionalArray(tag:type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV19decodeOptionalArray3tag4typeSayxGSgs6UInt32V_xmtKAA23StructDataRepresentableRzlF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeOptionalArray<T>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, type: T.Type = T.self) throws -> [T]? where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/StructDataRepresentable.html

- `


  ### [decodeMap(tag:keyType:valueType:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV9decodeMap3tag7keyType05valueJ0SDyxq_Gs6UInt32V_xmq_mtKAA6ScalarRzAA23StructDataRepresentableR_r0_lF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeMap<K, V>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, keyType: K.Type = K.self, valueType: V.Type = V.self) throws -> [K : V] where K : https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK6ScalarP, V : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/StructDataRepresentable.html

- `


  ### [decodeMap(tag:keyType:valueType:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV9decodeMap3tag7keyType05valueJ0SDyxq_Gs6UInt32V_xmq_mtKAA6ScalarRzAaKR_r0_lF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeMap<K, V>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, keyType: K.Type = K.self, valueType: V.Type = V.self) throws -> [K : V] where K : https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK6ScalarP, V : https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK6ScalarP

- `


  ### [decodeOptionalMap(tag:keyType:valueType:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV17decodeOptionalMap3tag7keyType05valueK0SDyxq_GSgs6UInt32V_xmq_mtKAA6ScalarRzAA23StructDataRepresentableR_r0_lF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeOptionalMap<K, V>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, keyType: K.Type = K.self, valueType: V.Type = V.self) throws -> [K : V]? where K : https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK6ScalarP, V : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/StructDataRepresentable.html

- `


  ### [decodeOptionalMap(tag:keyType:valueType:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV17decodeOptionalMap3tag7keyType05valueK0SDyxq_GSgs6UInt32V_xmq_mtKAA6ScalarRzAaLR_r0_lF)


  ` Undocumented

  #### Declaration

  Swift

      func decodeOptionalMap<K, V>(tag: https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK5TagIDa, keyType: K.Type = K.self, valueType: V.Type = V.self) throws -> [K : V]? where K : https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK6ScalarP, V : https://developers.home.google.com/reference/swift/GoogleHomeSDK/GoogleHomeSDK.html#/s:13GoogleHomeSDK6ScalarP

- `


  ### [defaultValue(type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV12defaultValue4typexxm_tAA20DefaultConstructibleRzlFZ)


  ` Returns the default value for any type that's DefaultConstructible.

  #### Declaration

  Swift

      static func defaultValue<T>(type: T.Type = T.self) -> T where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/DefaultConstructible.html

- `


  ### [defaultValue(type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV12defaultValue4typexSgAFm_tlFZ)


  ` Undocumented

  #### Declaration

  Swift

      static func defaultValue<T>(type: T?.Type = Optional<T>.self) -> T?

- `


  ### [defaultValue(type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV12defaultValue4typeSayxGAFm_tlFZ)


  ` Returns an empty array as the default value for any array types.

  #### Declaration

  Swift

      static func defaultValue<T>(type: [T].Type = [T].self) -> [T]

- `


  ### [defaultValue(typeK:typeV:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV12defaultValue5typeK0H1VSDyxq_Gxm_q_mtSHRzr0_lFZ)


  ` Returns an empty dictionary as the default value for any dictionary types.

  #### Declaration

  Swift

      static func defaultValue<K, V>(typeK: K.Type = K.self, typeV: V.Type = V.self) -> [K : V] where K : Hashable

- `


  ### [defaultValue(type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV12defaultValue4typexxm_tAA6BitmapRzlFZ)


  ` Returns 0 (no bits set) the default value for any Bitmap types.

  #### Declaration

  Swift

      static func defaultValue<T>(type: T.Type = T.self) -> T where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Bitmap.html

- `


  ### [defaultValue(type:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/TraitDecoder#/s:13GoogleHomeSDK12TraitDecoderV12defaultValue4typexxm_tAA4EnumRzlFZ)


  ` Returns .unrecognizedCase() as the default value for any Enum types.

  #### Declaration

  Swift

      static func defaultValue<T>(type: T.Type = T.self) -> T where T : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Enum.html