Required Instance Methodswift 6.0.1Swift
decode(_:)
Decodes a value of the given type.
mutating func decode(_ type: UInt16.Type) throws -> UInt16
Parameters
- 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.
DecodingError.valueNotFound
if the encountered encoded value is null, or of there are no more values to decode.
Other requirements
View members
Hide members
This section is hidden by default because it contains too many (41) members.
Instance members
var codingPath: [any CodingKey]
The path of coding keys taken to get to this point in decoding.
var count: Int?
The number of elements contained within this container.
var currentIndex: Int
The current decoding index of the container (i.e. the index of the next element to be decoded.) Incremented after every successful decode call.
var isAtEnd: Bool
A Boolean value indicating whether there are no more elements left to be decoded in the container.
func decode(String.Type
) throws -> String Decodes a value of the given type.
func decode(Bool.Type
) throws -> Bool Decodes a value of the given type.
func decode(Double.Type
) throws -> Double Decodes a value of the given type.
func decode(Float.Type
) throws -> Float Decodes a value of the given type.
func decode(Int.Type
) throws -> Int Decodes a value of the given type.
func decode(UInt.Type
) throws -> UInt Decodes a value of the given type.
func decode<T>(T.Type
) throws -> T Decodes a value of the given type.
func decode(Int8.Type
) throws -> Int8 Decodes a value of the given type.
func decode(Int16.Type
) throws -> Int16 Decodes a value of the given type.
func decode(Int32.Type
) throws -> Int32 Decodes a value of the given type.
func decode(Int64.Type
) throws -> Int64 Decodes a value of the given type.
func decode(UInt8.Type
) throws -> UInt8 Decodes a value of the given type.
func decode(Int128.Type
) throws -> Int128 Decodes a value of the given type.
func decode(UInt32.Type
) throws -> UInt32 Decodes a value of the given type.
func decode(UInt64.Type
) throws -> UInt64 Decodes a value of the given type.
func decode(UInt128.Type
) throws -> UInt128 Decodes a value of the given type.
func decodeIfPresent(String.Type
) throws -> String? Decodes a value of the given type, if present.
func decodeIfPresent(Bool.Type
) throws -> Bool? Decodes a value of the given type, if present.
func decodeIfPresent(Double.Type
) throws -> Double? Decodes a value of the given type, if present.
func decodeIfPresent(Float.Type
) throws -> Float? Decodes a value of the given type, if present.
func decodeIfPresent(Int.Type
) throws -> Int? Decodes a value of the given type, if present.
func decodeIfPresent(UInt.Type
) throws -> UInt? Decodes a value of the given type, if present.
func decodeIfPresent<T>(T.Type
) throws -> T? Decodes a value of the given type, if present.
func decodeIfPresent(Int8.Type
) throws -> Int8? Decodes a value of the given type, if present.
func decodeIfPresent(Int16.Type
) throws -> Int16? Decodes a value of the given type, if present.
func decodeIfPresent(Int32.Type
) throws -> Int32? Decodes a value of the given type, if present.
func decodeIfPresent(Int64.Type
) throws -> Int64? Decodes a value of the given type, if present.
func decodeIfPresent(UInt8.Type
) throws -> UInt8? Decodes a value of the given type, if present.
func decodeIfPresent(Int128.Type
) throws -> Int128? Decodes a value of the given type, if present.
func decodeIfPresent(UInt16.Type
) throws -> UInt16? Decodes a value of the given type, if present.
func decodeIfPresent(UInt32.Type
) throws -> UInt32? Decodes a value of the given type, if present.
func decodeIfPresent(UInt64.Type
) throws -> UInt64? Decodes a value of the given type, if present.
func decodeIfPresent(UInt128.Type
) throws -> UInt128? Decodes a value of the given type, if present.
func decodeNil(
) throws -> Bool Decodes a null value.
func nestedContainer<NestedKey>(keyedBy: NestedKey.Type
) throws -> KeyedDecodingContainer<NestedKey> Decodes a nested container keyed by the given type.
func nestedUnkeyedContainer(
) throws -> any UnkeyedDecodingContainer Decodes an unkeyed nested container.
func superDecoder(
) throws -> any Decoder Decodes a nested container and returns a
Decoder
instance for decodingsuper
from that container.