SingleValueDecodingContainer

protocol SingleValueDecodingContainer

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

Import import Swift

Instance Variables

var codingPath: [CodingKey] Required

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

Declaration

var codingPath: [CodingKey] { get }

Instance Methods

func decode(_: Bool.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: Bool.Type) throws -> Bool
func decode(_: Double.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: Double.Type) throws -> Double
func decode(_: Float.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: Float.Type) throws -> Float
func decode(_: Int.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: Int.Type) throws -> Int
func decode(_: Int8.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: Int8.Type) throws -> Int8
func decode(_: Int16.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: Int16.Type) throws -> Int16
func decode(_: Int32.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: Int32.Type) throws -> Int32
func decode(_: Int64.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: Int64.Type) throws -> Int64
func decode(_: String.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: String.Type) throws -> String
func decode(_: UInt.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: UInt.Type) throws -> UInt
func decode(_: UInt8.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: UInt8.Type) throws -> UInt8
func decode(_: UInt16.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: UInt16.Type) throws -> UInt16
func decode(_: UInt32.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: UInt32.Type) throws -> UInt32
func decode(_: UInt64.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode(_ type: UInt64.Type) throws -> UInt64
func decode<T>(_: T.Type) Required

Decodes a single value of the given type.

type: The type to decode as. returns: A value of the requested type. throws: DecodingError.typeMismatch if the encountered encoded value cannot be converted to the requested type. throws: DecodingError.valueNotFound if the encountered encoded value is null.

Declaration

func decode<T>(_ type: T.Type) throws -> T where T : Decodable
func decodeNil() Required

Decodes a null value.

returns: Whether the encountered value was null.

Declaration

func decodeNil() -> Bool