Decoder

protocol Decoder

A type that can decode values from a native format into in-memory representations.

Instance Variables

var codingPath Required

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

Declaration

var codingPath: [CodingKey]
var userInfo Required

Any contextual information set by the user for decoding.

Declaration

var userInfo: [CodingUserInfoKey : Any]

Instance Methods

func container(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> Required

Returns the data stored in this decoder as represented in a container keyed by the given key type.

  • parameter type: The key type to use for the container.

Declaration

func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> where Key: CodingKey
func singleValueContainer() throws -> SingleValueDecodingContainer Required

Returns the data stored in this decoder as represented in a container appropriate for holding a single primitive value.

Declaration

func singleValueContainer() throws -> SingleValueDecodingContainer
func unkeyedContainer() throws -> UnkeyedDecodingContainer Required

Returns the data stored in this decoder as represented in a container appropriate for holding values with no keys.

Declaration

func unkeyedContainer() throws -> UnkeyedDecodingContainer