Protocol

KeyedEncodingContainerProtocol

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

Declaration

protocol KeyedEncodingContainerProtocol

Overview

Encoders should provide types conforming to KeyedEncodingContainerProtocol for their format.

Topics

Associated Types

Instance Properties

var codingPath: [CodingKey]

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

Required.

Instance Methods

func encode(Bool, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(Float, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(UInt32, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(Int64, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode<T>(T, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(UInt, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(UInt64, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(UInt8, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(String, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(UInt16, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(Int, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(Double, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(Int8, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(Int32, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encode(Int16, forKey: Self.Key)

Encodes the given value for the given key.

Required.

func encodeConditional<T>(T, forKey: Self.Key)

Encodes a reference to the given object only if it is encoded unconditionally elsewhere in the payload (previously, or in the future).

Required. Default implementation provided.

func encodeIfPresent(String?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(Bool?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required. Default implementations provided.

func encodeIfPresent(Double?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(Float?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(Int?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(UInt?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(Int8?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(Int16?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(Int32?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(Int64?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(UInt8?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(UInt16?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(UInt32?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent(UInt64?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeIfPresent<T>(T?, forKey: Self.Key)

Encodes the given value for the given key if it is not nil.

Required.

func encodeNil(forKey: Self.Key)

Encodes a null value for the given key.

Required.

func nestedContainer<NestedKey>(keyedBy: NestedKey.Type, forKey: Self.Key) -> KeyedEncodingContainer<NestedKey>

Stores a keyed encoding container for the given key and returns it.

Required.

func nestedUnkeyedContainer(forKey: Self.Key) -> UnkeyedEncodingContainer

Stores an unkeyed encoding container for the given key and returns it.

Required.

func superEncoder() -> Encoder

Stores a new nested container for the default super key and returns A new encoder instance for encoding super into that container.

Required.

func superEncoder(forKey: Self.Key) -> Encoder

Stores a new nested container for the given key and returns A new encoder instance for encoding super into that container.

Required.

Relationships

Conforming Types

See Also

Encoding Containers

protocol SingleValueEncodingContainer

A container that can support the storage and direct encoding of a single non-keyed value.

struct KeyedEncodingContainer

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

protocol UnkeyedEncodingContainer

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