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. Decoders should provide types conforming to UnkeyedDecodingContainer for their format. Import import Swift Instance Variables var codingPath: [CodingKey] Required The path of coding keys taken to get to this point in decoding. Declaration var codingPath: [CodingKey] { get } var count: Int? Required The number of elements contained within this container. If the number of elements is unknown, the value is nil. Declaration var count: Int? { get } var currentIndex: Int Required The current decoding index of the container (i.e. the index of the next element to be decoded.) Incremented after every successful decode call. Declaration var currentIndex: Int { get } var isAtEnd: Bool Required A Boolean value indicating whether there are no more elements left to be decoded in the container. Declaration var isAtEnd: Bool { get } Instance Methods mutating func decode(_: Bool.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: Bool.Type) throws -> Bool mutating func decode(_: Double.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: Double.Type) throws -> Double mutating func decode(_: Float.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: Float.Type) throws -> Float mutating func decode(_: Int.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: Int.Type) throws -> Int mutating func decode(_: Int8.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: Int8.Type) throws -> Int8 mutating func decode(_: Int16.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: Int16.Type) throws -> Int16 mutating func decode(_: Int32.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: Int32.Type) throws -> Int32 mutating func decode(_: Int64.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: Int64.Type) throws -> Int64 mutating func decode(_: String.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: String.Type) throws -> String mutating func decode(_: UInt.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: UInt.Type) throws -> UInt mutating func decode(_: UInt8.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: UInt8.Type) throws -> UInt8 mutating func decode(_: UInt16.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: UInt16.Type) throws -> UInt16 mutating func decode(_: UInt32.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: UInt32.Type) throws -> UInt32 mutating func decode(_: UInt64.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode(_ type: UInt64.Type) throws -> UInt64 mutating func decode<T>(_: T.Type) Required Decodes a value of the given type. type: The type of value to decode. 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. throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func decode<T>(_ type: T.Type) throws -> T where T : Decodable mutating func decodeIfPresent(_: Bool.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: Bool.Type) throws -> Bool? mutating func decodeIfPresent(_: Double.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: Double.Type) throws -> Double? mutating func decodeIfPresent(_: Float.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: Float.Type) throws -> Float? mutating func decodeIfPresent(_: Int.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: Int.Type) throws -> Int? mutating func decodeIfPresent(_: Int8.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: Int8.Type) throws -> Int8? mutating func decodeIfPresent(_: Int16.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: Int16.Type) throws -> Int16? mutating func decodeIfPresent(_: Int32.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: Int32.Type) throws -> Int32? mutating func decodeIfPresent(_: Int64.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: Int64.Type) throws -> Int64? mutating func decodeIfPresent(_: String.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: String.Type) throws -> String? mutating func decodeIfPresent(_: UInt.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: UInt.Type) throws -> UInt? mutating func decodeIfPresent(_: UInt8.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: UInt8.Type) throws -> UInt8? mutating func decodeIfPresent(_: UInt16.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: UInt16.Type) throws -> UInt16? mutating func decodeIfPresent(_: UInt32.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: UInt32.Type) throws -> UInt32? mutating func decodeIfPresent(_: UInt64.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent(_ type: UInt64.Type) throws -> UInt64? mutating func decodeIfPresent<T>(_: T.Type) Decodes a value of the given type, if present. This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. type: The type of value to decode. returns: A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. throws: DecodingError.typeMismatch if the encountered encoded value is not convertible to the requested type. Declaration mutating func decodeIfPresent<T>(_ type: T.Type) throws -> T? where T : Decodable mutating func decodeNil() Required Decodes a null value. If the value is not null, does not increment currentIndex. returns: Whether the encountered value was null. throws: DecodingError.valueNotFound if there are no more values to decode. Declaration mutating func decodeNil() throws -> Bool mutating func nestedContainer(keyedBy:) Required Decodes a nested container keyed by the given type. type: The key type to use for the container. returns: A keyed decoding container view into self. throws: DecodingError.typeMismatch if the encountered stored value is not a keyed container. Declaration mutating func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type) throws -> KeyedDecodingContainer<NestedKey> where NestedKey : CodingKey mutating func nestedUnkeyedContainer() Required Decodes an unkeyed nested container. returns: An unkeyed decoding container view into self. throws: DecodingError.typeMismatch if the encountered stored value is not an unkeyed container. Declaration mutating func nestedUnkeyedContainer() throws -> UnkeyedDecodingContainer mutating func superDecoder() Required Decodes a nested container and returns a Decoder instance for decoding super from that container. returns: A new Decoder to pass to super.init(from:). throws: DecodingError.valueNotFound if the encountered encoded value is null, or of there are no more values to decode. Declaration mutating func superDecoder() throws -> Decoder Default Implementations mutating func decodeIfPresent(_: Bool.Type) Declaration mutating func decodeIfPresent(_ type: Bool.Type) throws -> Bool? mutating func decodeIfPresent(_: Double.Type) Declaration mutating func decodeIfPresent(_ type: Double.Type) throws -> Double? mutating func decodeIfPresent(_: Float.Type) Declaration mutating func decodeIfPresent(_ type: Float.Type) throws -> Float? mutating func decodeIfPresent(_: Int.Type) Declaration mutating func decodeIfPresent(_ type: Int.Type) throws -> Int? mutating func decodeIfPresent(_: Int8.Type) Declaration mutating func decodeIfPresent(_ type: Int8.Type) throws -> Int8? mutating func decodeIfPresent(_: Int16.Type) Declaration mutating func decodeIfPresent(_ type: Int16.Type) throws -> Int16? mutating func decodeIfPresent(_: Int32.Type) Declaration mutating func decodeIfPresent(_ type: Int32.Type) throws -> Int32? mutating func decodeIfPresent(_: Int64.Type) Declaration mutating func decodeIfPresent(_ type: Int64.Type) throws -> Int64? mutating func decodeIfPresent(_: String.Type) Declaration mutating func decodeIfPresent(_ type: String.Type) throws -> String? mutating func decodeIfPresent(_: UInt.Type) Declaration mutating func decodeIfPresent(_ type: UInt.Type) throws -> UInt? mutating func decodeIfPresent(_: UInt8.Type) Declaration mutating func decodeIfPresent(_ type: UInt8.Type) throws -> UInt8? mutating func decodeIfPresent(_: UInt16.Type) Declaration mutating func decodeIfPresent(_ type: UInt16.Type) throws -> UInt16? mutating func decodeIfPresent(_: UInt32.Type) Declaration mutating func decodeIfPresent(_ type: UInt32.Type) throws -> UInt32? mutating func decodeIfPresent(_: UInt64.Type) Declaration mutating func decodeIfPresent(_ type: UInt64.Type) throws -> UInt64? mutating func decodeIfPresent<T>(_: T.Type) Declaration mutating func decodeIfPresent<T>(_ type: T.Type) throws -> T? where T : Decodable