Structures
The following structures are available globally.
-
A type-erased
Codablevalue.The
AnyCodabletype forwards encoding and decoding responsibilitiesto an underlying value, hiding its specific underlying type.
You can encode or decode mixed-type values in dictionaries
and other collections that require
EncodableorDecodableconformanceby declaring their contained type to be
AnyCodable.See also
See moreSee also
Declaration
Swift
public struct AnyCodable : Codableextension AnyCodable: _AnyEncodable, _AnyDecodableextension AnyCodable: Equatableextension AnyCodable: Comparableextension AnyCodable: CustomStringConvertibleextension AnyCodable: CustomDebugStringConvertibleextension AnyCodable: ExpressibleByNilLiteral, ExpressibleByBooleanLiteral, ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral, ExpressibleByStringLiteral, ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral -
A type-erased
Decodablevalue.The
AnyDecodabletype forwards decoding responsibilitiesto an underlying value, hiding its specific underlying type.
You can decode mixed-type values in dictionaries
and other collections that require
Decodableconformanceby 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 moreDeclaration
Swift
public struct AnyDecodable : Decodableextension AnyDecodable: _AnyDecodableextension AnyDecodable: Equatableextension AnyDecodable: CustomStringConvertibleextension AnyDecodable: CustomDebugStringConvertible -
A type-erased
Encodablevalue.The
AnyEncodabletype forwards encoding responsibilitiesto an underlying value, hiding its specific underlying type.
You can encode mixed-type values in dictionaries
and other collections that require
Encodableconformanceby 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 moreDeclaration
Swift
public struct AnyEncodable : Encodableextension AnyEncodable: _AnyEncodableextension AnyEncodable: Equatableextension AnyEncodable: CustomStringConvertibleextension AnyEncodable: CustomDebugStringConvertibleextension AnyEncodable: ExpressibleByNilLiteral, ExpressibleByBooleanLiteral, ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral, ExpressibleByStringLiteral, ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral -
Represents changes in the objects kept for lifecycle management by the
See moreObjectLifecycleController. Changes are provided by the propertiesadded,removed, orchangedwhere exactly one is set and the others are not defined.Declaration
Swift
public struct ObjectLifecycleInfo
-
Defines a rule for associating IO sources with IO actors.
See moreDeclaration
Swift
public struct IoAssociationRule -
Utility functions to cope with the Coaty compatible timestamp format. In Coaty, a timestamp defines the number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC. In Swift, a Coaty timestamp should be represented as a
See moreDoublevalue.Declaration
Swift
public struct CoatyTimestamp -
A convenience struct used to define an IoNode
See moreDeclaration
Swift
public struct IoNodeDefinition -
An ObservedProperty specifies the phenomenon of an Observation.
See moreDeclaration
Swift
public struct ObservedProperty : Codable
-
Static definition of a sensor for use in SensorController.
This is used in the options of the controller to register the sensors directly at creation. The
sensorsoption of the SensorController should contain an array of SensorDefinitions.Each definition should contain the Sensor object, the hardware pin that it is connected to, and the type of the IO communication that it has.
See moreDeclaration
Swift
public struct SensorDefinition
-
The registered sensors as they are used by the SensorController.
This contains the Sensor object that is used for communication and the IO interface that defines the hardware connection and how the pin is read and written to.
Declaration
Swift
public struct SensorContainer
-
Represents change information when sensors are registered or deregistered.
See moreDeclaration
Swift
public struct RegisteredSensorsChangeInfo -
An object containing three key-value pairs:
- The name property presents the full name of the unitOfMeasurement.
- The symbol property shows the textual form of the unit symbol.
- The definition contains the URI defining the unitOfMeasurement.
The values of these properties SHOULD follow the Unified Code for Unit of Measure (UCUM).
See moreDeclaration
Swift
public struct UnitOfMeasurement : Codable
View on GitHub
Structures Reference