Decodable

extension Decodable

Extensions to simplify conversion between Decodable types and dictionaries.

  • Creates an instance of the conforming type from a dictionary with string keys and Sendable values.

    This convenience initializer converts the dictionary to JSON data and then decodes it using the type’s Decodable implementation.

    Declaration

    Swift

    public init?(dictionary: [String : any Sendable])

    Parameters

    dictionary

    A dictionary with string keys and Sendable values to decode from

    Return Value

    An instance of the conforming type, or nil if decoding fails