DictionaryDecoder

open class DictionaryDecoder

DictionaryDecoder facilitates the decoding of Dictionaries into semantic Decodable types.

  • Initializes self with default strategies.

    Declaration

    Swift

    public init()
  • Decodes a top-level value of the given type from the given dictionary representation.

    Throws

    DecodingError.dataCorrupted if values requested from the payload are corrupted.

    Throws

    An error if any value throws an error during decoding.

    Declaration

    Swift

    open func decode<T>(_ type: T.Type, from dictionary: Any) throws -> T where T : Decodable

    Parameters

    type

    The type of the value to decode.

    from

    The dictionary to decode from.

    Return Value

    A value of the requested type.