Structures
The following structures are available globally.
-
A type-erased
Codable
value.The
AnyCodable
type 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
Encodable
orDecodable
conformanceby declaring their contained type to be
AnyCodable
.See also
See also
Declaration
Swift
public struct AnyCodable : Codable
extension AnyCodable: _AnyEncodable, _AnyDecodable
extension AnyCodable: Equatable
extension AnyCodable: Comparable
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 responsibilitiesto an underlying value, hiding its specific underlying type.
You can decode mixed-type values in dictionaries
and other collections that require
Decodable
conformanceby 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 : Decodable
extension AnyDecodable: _AnyDecodable
extension AnyDecodable: Equatable
extension AnyDecodable: CustomStringConvertible
extension AnyDecodable: CustomDebugStringConvertible
-
A type-erased
Encodable
value.The
AnyEncodable
type forwards encoding responsibilitiesto an underlying value, hiding its specific underlying type.
You can encode mixed-type values in dictionaries
and other collections that require
Encodable
conformanceby 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 : Encodable
extension AnyEncodable: _AnyEncodable
extension AnyEncodable: Equatable
extension AnyEncodable: CustomStringConvertible
extension AnyEncodable: CustomDebugStringConvertible
extension 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
, orchanged
where 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 moreDouble
value.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
sensors
option 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