Structures

The following structures are available globally.

  • A type-erased Codable value.

    The AnyCodable type forwards encoding and decoding responsibilities to an underlying value, hiding its specific underlying type.

    You can encode or decode mixed-type values in dictionaries and other collections that require Encodable or Decodable conformance by declaring their contained type to be AnyCodable.

    See also

    AnyEncodable

    See also

    AnyDecodable
    See more

    Declaration

    Swift

    public struct AnyCodable : Codable
    extension AnyCodable: Equatable
    extension AnyCodable: CustomStringConvertible
    extension AnyCodable: CustomDebugStringConvertible
    extension AnyCodable: ExpressibleByNilLiteral,
    ExpressibleByBooleanLiteral,
    ExpressibleByIntegerLiteral,
    ExpressibleByFloatLiteral,
    ExpressibleByStringLiteral,
    ExpressibleByArrayLiteral,
    ExpressibleByDictionaryLiteral
  • A type-erased Decodable value.

    The AnyDecodable type forwards decoding responsibilities to an underlying value, hiding its specific underlying type.

    You can decode mixed-type values in dictionaries and other collections that require Decodable conformance by declaring their contained type to be AnyDecodable:

    let json = """
    {
        "boolean": true,
        "integer": 1,
        "double": 3.14159265358979323846,
        "string": "string",
        "array": [1, 2, 3],
        "nested": {
            "a": "alpha",
            "b": "bravo",
            "c": "charlie"
        }
    }
    """.data(using: .utf8)!
    
    let decoder = JSONDecoder()
    let dictionary = try! decoder.decode([String: AnyCodable].self, from: json)
    
    See more

    Declaration

    Swift

    public struct AnyDecodable : Decodable
    extension AnyDecodable: Equatable
    extension AnyDecodable: CustomStringConvertible
    extension AnyDecodable: CustomDebugStringConvertible
  • A type-erased Encodable value.

    The AnyEncodable type forwards encoding responsibilities to an underlying value, hiding its specific underlying type.

    You can encode mixed-type values in dictionaries and other collections that require Encodable conformance by declaring their contained type to be AnyEncodable:

    let dictionary: [String: AnyEncodable] = [
        "boolean": true,
        "integer": 1,
        "double": 3.14159265358979323846,
        "string": "string",
        "array": [1, 2, 3],
        "nested": [
            "a": "alpha",
            "b": "bravo",
            "c": "charlie"
        ]
    ]
    
    let encoder = JSONEncoder()
    let json = try! encoder.encode(dictionary)
    
    See more

    Declaration

    Swift

    public struct AnyEncodable : Encodable
    extension AnyEncodable: Equatable
    extension AnyEncodable: CustomStringConvertible
    extension AnyEncodable: CustomDebugStringConvertible
    extension AnyEncodable: ExpressibleByNilLiteral,
    ExpressibleByBooleanLiteral,
    ExpressibleByIntegerLiteral,
    ExpressibleByFloatLiteral,
    ExpressibleByStringLiteral,
    ExpressibleByArrayLiteral,
    ExpressibleByDictionaryLiteral
  • An error type for keychain operations.

    See more

    Declaration

    Swift

    public struct KeychainError : Error
  • A struct representation of a generic password item in the keychain.

    The keychain query uses generic password for the item’s class, the serviceName property for the item’s service, and the account property for the item’s account name.

    See more

    Declaration

    Swift

    public struct KeychainItem

MultipartAttachments

  • Struct representing a multipart attachment to a multipart form data request

    See more

    Declaration

    Swift

    public struct MultipartAttachment : Equatable