Generic Structure

KeyedDecodingContainer

A concrete container that provides a view into a decoder’s storage, making the encoded properties of a decodable type accessible by keys.

Declaration

struct KeyedDecodingContainer<K> where K : CodingKey

Topics

Initializers

init<Container>(Container)

Creates a new instance with the given container.

Instance Properties

var allKeys: [KeyedDecodingContainer<K>.Key]

All the keys the decoder has for this container.

var codingPath: [CodingKey]

The path of coding keys taken to get to this point in decoding.

Instance Methods

func contains(KeyedDecodingContainer<K>.Key) -> Bool

Returns a Boolean value indicating whether the decoder contains a value associated with the given key.

func decode(Double.Type, forKey: KeyedDecodingContainer<K>.Key) -> Double

Decodes a value of the given type for the given key.

func decode(UInt64.Type, forKey: KeyedDecodingContainer<K>.Key) -> UInt64

Decodes a value of the given type for the given key.

func decode(Int64.Type, forKey: KeyedDecodingContainer<K>.Key) -> Int64

Decodes a value of the given type for the given key.

func decode(UInt16.Type, forKey: KeyedDecodingContainer<K>.Key) -> UInt16

Decodes a value of the given type for the given key.

func decode(String.Type, forKey: KeyedDecodingContainer<K>.Key) -> String

Decodes a value of the given type for the given key.

func decode(Int32.Type, forKey: KeyedDecodingContainer<K>.Key) -> Int32

Decodes a value of the given type for the given key.

func decode(Bool.Type, forKey: KeyedDecodingContainer<K>.Key) -> Bool

Decodes a value of the given type for the given key.

func decode<T>(T.Type, forKey: KeyedDecodingContainer<K>.Key) -> T

Decodes a value of the given type for the given key.

func decode(UInt8.Type, forKey: KeyedDecodingContainer<K>.Key) -> UInt8

Decodes a value of the given type for the given key.

func decode(UInt32.Type, forKey: KeyedDecodingContainer<K>.Key) -> UInt32

Decodes a value of the given type for the given key.

func decode(Int8.Type, forKey: KeyedDecodingContainer<K>.Key) -> Int8

Decodes a value of the given type for the given key.

func decode(Float.Type, forKey: KeyedDecodingContainer<K>.Key) -> Float

Decodes a value of the given type for the given key.

func decode(Int.Type, forKey: KeyedDecodingContainer<K>.Key) -> Int

Decodes a value of the given type for the given key.

func decode(Int16.Type, forKey: KeyedDecodingContainer<K>.Key) -> Int16

Decodes a value of the given type for the given key.

func decode(UInt.Type, forKey: KeyedDecodingContainer<K>.Key) -> UInt

Decodes a value of the given type for the given key.

func decodeIfPresent(Int.Type, forKey: KeyedDecodingContainer<K>.Key) -> Int?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(Bool.Type, forKey: KeyedDecodingContainer<K>.Key) -> Bool?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(String.Type, forKey: KeyedDecodingContainer<K>.Key) -> String?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(UInt32.Type, forKey: KeyedDecodingContainer<K>.Key) -> UInt32?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(UInt16.Type, forKey: KeyedDecodingContainer<K>.Key) -> UInt16?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(UInt64.Type, forKey: KeyedDecodingContainer<K>.Key) -> UInt64?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(UInt.Type, forKey: KeyedDecodingContainer<K>.Key) -> UInt?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(Int64.Type, forKey: KeyedDecodingContainer<K>.Key) -> Int64?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(UInt8.Type, forKey: KeyedDecodingContainer<K>.Key) -> UInt8?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(Int8.Type, forKey: KeyedDecodingContainer<K>.Key) -> Int8?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(Int32.Type, forKey: KeyedDecodingContainer<K>.Key) -> Int32?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent<T>(T.Type, forKey: KeyedDecodingContainer<K>.Key) -> T?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(Double.Type, forKey: KeyedDecodingContainer<K>.Key) -> Double?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(Float.Type, forKey: KeyedDecodingContainer<K>.Key) -> Float?

Decodes a value of the given type for the given key, if present.

func decodeIfPresent(Int16.Type, forKey: KeyedDecodingContainer<K>.Key) -> Int16?

Decodes a value of the given type for the given key, if present.

func nestedContainer<NestedKey>(keyedBy: NestedKey.Type, forKey: KeyedDecodingContainer<K>.Key) -> KeyedDecodingContainer<NestedKey>

Returns the data stored for the given key as represented in a container keyed by the given key type.

func nestedUnkeyedContainer(forKey: KeyedDecodingContainer<K>.Key) -> UnkeyedDecodingContainer

Returns the data stored for the given key as represented in an unkeyed container.

func superDecoder() -> Decoder

Returns a Decoder instance for decoding super from the container associated with the default super key.

func superDecoder(forKey: KeyedDecodingContainer<K>.Key) -> Decoder

Returns a Decoder instance for decoding super from the container associated with the given key.

Relationships

See Also

Decoding Containers

protocol SingleValueDecodingContainer

A container that can support the storage and direct decoding of a single nonkeyed value.

protocol KeyedDecodingContainerProtocol

A type that provides a view into a decoder’s storage and is used to hold the encoded properties of a decodable type in a keyed manner.

protocol UnkeyedDecodingContainer

A type that provides a view into a decoder’s storage and is used to hold the encoded properties of a decodable type sequentially, without keys.