Structures
The following structures are available globally.
- 
                  
                  
A type-erased
Codablevalue.The
AnyCodabletype 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
EncodableorDecodableconformance by declaring their contained type to beAnyCodable.See also
AnyEncodableSee moreSee also
AnyDecodableDeclaration
Swift
public struct AnyCodable : Codableextension AnyCodable: Equatableextension AnyCodable: CustomStringConvertibleextension AnyCodable: CustomDebugStringConvertibleextension AnyCodable: ExpressibleByNilLiteral, ExpressibleByBooleanLiteral, ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral, ExpressibleByStringLiteral, ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral - 
                  
                  
A type-erased
Decodablevalue.The
AnyDecodabletype 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
Decodableconformance by declaring their contained type to beAnyDecodable:
See morelet 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)Declaration
Swift
public struct AnyDecodable : Decodableextension AnyDecodable: Equatableextension AnyDecodable: CustomStringConvertibleextension AnyDecodable: CustomDebugStringConvertible - 
                  
                  
A type-erased
Encodablevalue.The
AnyEncodabletype 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
Encodableconformance by declaring their contained type to beAnyEncodable:
See morelet 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)Declaration
Swift
public struct AnyEncodable : Encodableextension AnyEncodable: Equatableextension AnyEncodable: CustomStringConvertibleextension AnyEncodable: CustomDebugStringConvertibleextension AnyEncodable: ExpressibleByNilLiteral, ExpressibleByBooleanLiteral, ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral, ExpressibleByStringLiteral, ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral - 
                  
                  
An error type for keychain operations.
See moreDeclaration
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
See moreserviceNameproperty for the item’s service, and theaccountproperty for the item’s account name.Declaration
Swift
public struct KeychainItem 
- 
                  
                  
Struct representing a multipart attachment to a multipart form data request
See moreDeclaration
Swift
public struct MultipartAttachment : Equatable 
        Structures  Reference