CodingUserInfoKey

struct CodingUserInfoKey

A user-defined key for providing context during encoding and decoding.

Inheritance Equatable, Hashable, RawRepresentable View Protocol Hierarchy →
Associated Types
RawValue = String

The raw type that can be used to represent all values of the conforming type.

Every distinct value of the conforming type has a corresponding unique value of the RawValue type, but there may be values of the RawValue type that don't have a corresponding value of the conforming type.

Import import Swift

Initializers

init?(rawValue:)

Creates a new instance with the given raw value.

rawValue: The value of the key.

Declaration

init?(rawValue: String)

Instance Variables

var hashValue: Int

The key's hash value.

Declaration

var hashValue: Int { get }
var rawValue: String

The key's string value.

Declaration

var rawValue: String { get }

Conditionally Inherited Items

The initializers, methods, and properties listed below may be available on this type under certain conditions (such as methods that are available on Array when its elements are Equatable) or may not ever be available if that determination is beyond SwiftDoc.org's capabilities. Please open an issue on GitHub if you see something out of place!

Where RawValue == Bool

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is Bool.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is Bool.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == Double

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is Double.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is Double.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == Float

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is Float.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is Float.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == Int

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is Int.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is Int.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == Int16

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is Int16.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is Int16.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == Int32

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is Int32.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is Int32.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == Int64

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is Int64.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is Int64.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == Int8

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is Int8.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is Int8.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == String

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is String.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is String.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == UInt

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is UInt.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is UInt.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == UInt16

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is UInt16.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is UInt16.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == UInt32

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is UInt32.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is UInt32.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == UInt64

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is UInt64.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is UInt64.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable

Where RawValue == UInt8

init(from:)

Creates a new instance by decoding from the given decoder, when the type's RawValue is UInt8.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

decoder: The decoder to read data from.

Declaration

init(from decoder: Decoder)

Declared In

RawRepresentable
func encode(to:)

Encodes this value into the given encoder, when the type's RawValue is UInt8.

This function throws an error if any values are invalid for the given encoder's format.

encoder: The encoder to write data to.

Declaration

func encode(to encoder: Encoder) throws

Declared In

RawRepresentable