protocol SingleValueDecodingContainer
Import | import Swift |
---|
Instance Variables
The path of coding keys taken to get to this point in encoding.
Declaration
var codingPath: [CodingKey] { get }
Instance Methods
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Decodes a null value.
returns: Whether the encountered value was null.
Declaration
func decodeNil() -> Bool
A container that can support the storage and direct decoding of a single nonkeyed value.