UnkeyedEncodingContainer

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.

Encoders should provide types conforming to UnkeyedEncodingContainer for their format.

Instance Variables

var codingPath Required

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

Declaration

var codingPath: [CodingKey]
var count Required

The number of elements encoded into the container.

Declaration

var count: Int

Instance Methods

func encode(_ value: Bool) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: Bool) throws
func encode(_ value: String) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: String) throws
func encode(_ value: Double) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: Double) throws
func encode(_ value: Float) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: Float) throws
func encode(_ value: Int) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: Int) throws
func encode(_ value: Int8) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: Int8) throws
func encode(_ value: Int16) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: Int16) throws
func encode(_ value: Int32) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: Int32) throws
func encode(_ value: Int64) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: Int64) throws
func encode(_ value: UInt) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: UInt) throws
func encode(_ value: UInt8) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: UInt8) throws
func encode(_ value: UInt16) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: UInt16) throws
func encode(_ value: UInt32) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: UInt32) throws
func encode(_ value: UInt64) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode(_ value: UInt64) throws
func encode(_ value: T) throws Required

Encodes the given value.

  • parameter value: The value to encode.

Declaration

mutating func encode<T>(_ value: T) throws where T: Encodable
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == Bool
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == String
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == Double
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == Float
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == Int
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == Int8
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == Int16
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == Int32
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == Int64
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == UInt
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == UInt8
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == UInt16
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == UInt32
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element == UInt64
func encode(contentsOf sequence: T) throws Required

Encodes the elements of the given sequence.

  • parameter sequence: The sequences whose contents to encode.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws where T: Sequence, T.Element: Encodable
func encodeConditional(_ object: T) throws Required

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

For encoders which don't support this feature, the default implementation encodes the given object unconditionally.

For formats which don't support this feature, the default implementation encodes the given object unconditionally.

  • parameter object: The object to encode.

Declaration

mutating func encodeConditional<T>(_ object: T) throws where T: AnyObject, T: Encodable
func encodeNil() throws Required

Encodes a null value.

Declaration

mutating func encodeNil() throws
func nestedContainer(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> Required

Encodes a nested container keyed by the given type and returns it.

  • parameter keyType: The key type to use for the container.

Declaration

mutating func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey
func nestedUnkeyedContainer() -> UnkeyedEncodingContainer Required

Encodes an unkeyed encoding container and returns it.

Declaration

mutating func nestedUnkeyedContainer() -> UnkeyedEncodingContainer
func superEncoder() -> Encoder Required

Encodes a nested container and returns an Encoder instance for encoding super into that container.

Declaration

mutating func superEncoder() -> Encoder