Contents

decode(_:from:)

Returns a value of the specified type by decoding a property list using the default property list format.

Declaration

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

Parameters

  • type:

    The type of the value to decode from the supplied property list.

  • data:

    The property list to decode.

Discussion

If the data is not a valid property list, this method throws the DecodingError.dataCorrupted(_:) error. If a value within the property list fails to decode, this method throws the corresponding error.

See Also

Decoding