Decoder

public protocol Decoder

A protocol providing a decode<T: Decodable>(: T.Type, from: Data) -> T interface.

  • Decodes data to an instance of the indicated type.

    Declaration

    Swift

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

    Parameters

    type

    The type data is decoded to.

    data

    The data to decode.