DictionaryDecoder
open class DictionaryDecoder
DictionaryDecoder facilitates the decoding of Dictionaries into semantic Decodable types.
-
The strategy to use for decoding
See moreDatevalues.Declaration
Swift
public enum DateDecodingStrategy -
The strategy to use for decoding
See moreDatavalues.Declaration
Swift
public enum DataDecodingStrategy -
The strategy to use for non-JSON-conforming floating-point values (IEEE 754 infinity and NaN).
See moreDeclaration
Swift
public enum NonConformingFloatDecodingStrategy -
The strategy to use for automatically changing the value of keys before decoding.
See moreDeclaration
Swift
public enum KeyDecodingStrategy -
The strategy to use in decoding dates. Defaults to
.deferredToDate.Declaration
Swift
open var dateDecodingStrategy: DateDecodingStrategy -
The strategy to use in decoding binary data. Defaults to
.base64.Declaration
Swift
open var dataDecodingStrategy: DataDecodingStrategy -
The strategy to use in decoding non-conforming numbers. Defaults to
.throw.Declaration
Swift
open var nonConformingFloatDecodingStrategy: NonConformingFloatDecodingStrategy -
The strategy to use for decoding keys. Defaults to
.useDefaultKeys.Declaration
Swift
open var keyDecodingStrategy: KeyDecodingStrategy -
Contextual user-provided information for use during decoding.
Declaration
Swift
open var userInfo: [CodingUserInfoKey : Any]
-
Initializes
selfwith default strategies.Declaration
Swift
public init()
-
Decodes a top-level value of the given type from the given dictionary representation.
Throws
DecodingError.dataCorruptedif 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 : DecodableParameters
typeThe type of the value to decode.
fromThe dictionary to decode from.
Return Value
A value of the requested type.
View on GitHub
DictionaryDecoder Class Reference