protocol Decoder
Import | import Swift |
---|
Instance Variables
The path of coding keys taken to get to this point in decoding.
Declaration
var codingPath: [CodingKey] { get }
Any contextual information set by the user for decoding.
Declaration
var userInfo: [CodingUserInfoKey : Any] { get }
Instance Methods
Returns the data stored in this decoder as represented in a container keyed by the given key type.
type
: The key type to use for the container.
returns: A keyed decoding container view into this decoder.
throws: DecodingError.typeMismatch
if the encountered stored value is
not a keyed container.
Declaration
func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> where Key : CodingKey
Returns the data stored in this decoder as represented in a container appropriate for holding a single primitive value.
returns: A single value container view into this decoder.
throws: DecodingError.typeMismatch
if the encountered stored value is
not a single value container.
Declaration
func singleValueContainer() throws -> SingleValueDecodingContainer
Returns the data stored in this decoder as represented in a container appropriate for holding values with no keys.
returns: An unkeyed container view into this decoder.
throws: DecodingError.typeMismatch
if the encountered stored value is
not an unkeyed container.
Declaration
func unkeyedContainer() throws -> UnkeyedDecodingContainer
A type that can decode values from a native format into in-memory representations.