Required Instance Methodswift 6.0.1Swift
decode(_:forKey:)
Decodes a value of the given type for the given key.
func decode(_ type: UInt16.Type, forKey key: Self.Key) throws -> UInt16
Parameters
Returns
A value of the requested type, if present for the given key and convertible to the requested type.
Throws
DecodingError.typeMismatch
if the encountered encoded value is not convertible to the requested type.
DecodingError.keyNotFound
if self
does not have an entry for the given key.
DecodingError.valueNotFound
if self
has a null entry for the given key.
Other requirements
View members
Hide members
This section is hidden by default because it contains too many (42) members.
Type members
Instance members
var allKeys: [Self.Key]
All the keys the
Decoder
has for this container.var codingPath: [any CodingKey]
The path of coding keys taken to get to this point in decoding.
func contains(Self.Key
) -> Bool Returns a Boolean value indicating whether the decoder contains a value associated with the given key.
func decode(String.Type, forKey: Self.Key
) throws -> String Decodes a value of the given type for the given key.
func decode(Bool.Type, forKey: Self.Key
) throws -> Bool Decodes a value of the given type for the given key.
func decode(Double.Type, forKey: Self.Key
) throws -> Double Decodes a value of the given type for the given key.
func decode(Float.Type, forKey: Self.Key
) throws -> Float Decodes a value of the given type for the given key.
func decode(Int.Type, forKey: Self.Key
) throws -> Int Decodes a value of the given type for the given key.
func decode(UInt.Type, forKey: Self.Key
) throws -> UInt Decodes a value of the given type for the given key.
func decode<T>(T.Type, forKey: Self.Key
) throws -> T Decodes a value of the given type for the given key.
func decode(Int8.Type, forKey: Self.Key
) throws -> Int8 Decodes a value of the given type for the given key.
func decode(Int16.Type, forKey: Self.Key
) throws -> Int16 Decodes a value of the given type for the given key.
func decode(Int32.Type, forKey: Self.Key
) throws -> Int32 Decodes a value of the given type for the given key.
func decode(Int64.Type, forKey: Self.Key
) throws -> Int64 Decodes a value of the given type for the given key.
func decode(UInt8.Type, forKey: Self.Key
) throws -> UInt8 Decodes a value of the given type for the given key.
func decode(Int128.Type, forKey: Self.Key
) throws -> Int128 Decodes a value of the given type for the given key.
func decode(UInt32.Type, forKey: Self.Key
) throws -> UInt32 Decodes a value of the given type for the given key.
func decode(UInt64.Type, forKey: Self.Key
) throws -> UInt64 Decodes a value of the given type for the given key.
func decode(UInt128.Type, forKey: Self.Key
) throws -> UInt128 Decodes a value of the given type for the given key.
func decodeIfPresent(String.Type, forKey: Self.Key
) throws -> String? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(Bool.Type, forKey: Self.Key
) throws -> Bool? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(Double.Type, forKey: Self.Key
) throws -> Double? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(Float.Type, forKey: Self.Key
) throws -> Float? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(Int.Type, forKey: Self.Key
) throws -> Int? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(UInt.Type, forKey: Self.Key
) throws -> UInt? Decodes a value of the given type for the given key, if present.
func decodeIfPresent<T>(T.Type, forKey: Self.Key
) throws -> T? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(Int8.Type, forKey: Self.Key
) throws -> Int8? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(Int16.Type, forKey: Self.Key
) throws -> Int16? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(Int32.Type, forKey: Self.Key
) throws -> Int32? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(Int64.Type, forKey: Self.Key
) throws -> Int64? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(UInt8.Type, forKey: Self.Key
) throws -> UInt8? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(Int128.Type, forKey: Self.Key
) throws -> Int128? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(UInt16.Type, forKey: Self.Key
) throws -> UInt16? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(UInt32.Type, forKey: Self.Key
) throws -> UInt32? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(UInt64.Type, forKey: Self.Key
) throws -> UInt64? Decodes a value of the given type for the given key, if present.
func decodeIfPresent(UInt128.Type, forKey: Self.Key
) throws -> UInt128? Decodes a value of the given type for the given key, if present.
func decodeNil(forKey: Self.Key
) throws -> Bool Decodes a null value for the given key.
func nestedContainer<NestedKey>(keyedBy: NestedKey.Type, forKey: Self.Key
) throws -> KeyedDecodingContainer<NestedKey> Returns the data stored for the given key as represented in a container keyed by the given key type.
func nestedUnkeyedContainer(forKey: Self.Key
) throws -> any UnkeyedDecodingContainer Returns the data stored for the given key as represented in an unkeyed container.
func superDecoder(
) throws -> any Decoder Returns a
Decoder
instance for decodingsuper
from the container associated with the defaultsuper
key.func superDecoder(forKey: Self.Key
) throws -> any Decoder Returns a
Decoder
instance for decodingsuper
from the container associated with the given key.