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
orDecodable
conformance by declaring their contained type to beAnyCodable
.See also
AnyEncodable
See also
AnyDecodable
Declaration
Swift
public struct AnyCodable: Codable
-
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 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: Decodable
-
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 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: Encodable
-
Representation of a client stored in ThinCloud.
See moreDeclaration
Swift
public struct Client: Codable
-
GeoJSON Point structure.
See moreDeclaration
Swift
public struct Location: Codable
-
Representation of a device creation request to ThinCloud.
Declaration
Swift
public struct DeviceCreateRequest: Codable
-
Representation of a device update request to ThinCloud.
Declaration
Swift
public struct DeviceUpdateRequest: Codable
-
Representation of a device stored in ThinCloud.
See moreDeclaration
Swift
public struct Device: Codable
-
A command dispatched to a device.
See moreDeclaration
Swift
public struct DeviceCommand: Codable
-
Representation of a user update request to ThinCloud.
Declaration
Swift
public struct UserUpdateRequest: Codable
-
Representation of a user stored in ThinCloud.
See moreDeclaration
Swift
public struct User: Codable