decode(as:)
Decodes a message as the given type.
Declaration
func decode<T>(as type: T.Type = T.self) throws -> T where T : DecodableParameters
- type:
The type of the value in the message.
Return Value
A value of the specified type if the message data decodes successfully.
Discussion
If the message data doesn’t decode to the type, this method throws the appropriate DecodingError.