Contents

decode(_:from:)

Decode a decodable object from Data

Declaration

func decode<T>(_ type: T.Type, from data: Data) throws -> T where T : Decodable

Parameters

  • type:

    The type to decode into.

  • data:

    The data to use for decoding

Return Value

An instance of type T or throws an error if unable to decode.