KeyedErrorContainer

public struct KeyedErrorContainer<K> : Encoder, KeyedEncodingContainerProtocol, UnkeyedEncodingContainer, SingleValueEncodingContainer where K : CodingKey

A keyed, unkeyed, single value container and encoder that will throw an error in all methods it can throw and return another KeyedErrorContainer in all other methods.

  • Declaration

    Swift

    public let codingPath: [CodingKey]
  • Declaration

    Swift

    public let userInfo: [CodingUserInfoKey : Any]
  • The error this container throws

    Declaration

    Swift

    public let error: Error
  • Initalize a new KeyedErrorContainer with the given error, coding path and user info dictionary.

    Declaration

    Swift

    public init(error: Error, codingPath: [CodingKey], userInfo: [CodingUserInfoKey : Any] = [:])

encode

  • Declaration

    Swift

    public mutating mutating func encodeNil() throws
  • Declaration

    Swift

    public mutating mutating func encode<T>(_ value: T) throws where T : Encodable

encoder

  • Declaration

    Swift

    public func container<AnotherKey>(keyedBy type: AnotherKey.Type) -> KeyedEncodingContainer<AnotherKey> where AnotherKey : CodingKey
  • Declaration

    Swift

    public func unkeyedContainer() -> UnkeyedEncodingContainer
  • Declaration

    Swift

    public func singleValueContainer() -> SingleValueEncodingContainer

superEncoder

  • Declaration

    Swift

    public mutating mutating func superEncoder() -> Encoder

keyed container

  • Key

    Declaration

    Swift

    public typealias Key = K
  • Declaration

    Swift

    public mutating mutating func encodeNil(forKey key: K) throws
  • Declaration

    Swift

    public mutating mutating func encode<T>(_ value: T, forKey key: K) throws where T : Encodable
  • Declaration

    Swift

    public mutating mutating func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: K) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey
  • Declaration

    Swift

    public mutating mutating func nestedUnkeyedContainer(forKey key: K) -> UnkeyedEncodingContainer
  • Declaration

    Swift

    public mutating mutating func superEncoder(forKey key: K) -> Encoder

unkeyed contaienr

  • Declaration

    Swift

    public let count: Int
  • Declaration

    Swift

    public mutating mutating func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey
  • Declaration

    Swift

    public mutating mutating func nestedUnkeyedContainer() -> UnkeyedEncodingContainer