@tokamakdev/plugin-location 0.1.0-beta.127 → 0.1.0-beta.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1059 +0,0 @@
1
- // Generated by `tok bindings` from the iOS and macOS 26.2 SDKs: CoreLocation, _LocationEssentials. Do not edit.
2
-
3
- import Foundation
4
- import CoreLocation
5
- import _LocationEssentials
6
-
7
- #if hasAttribute(diagnose)
8
- @diagnose(DeprecatedDeclaration, as: ignored)
9
- #endif
10
- final class TokamakBindings_location: TokamakPlugin {
11
- let id = "location/apple"
12
- private let host: TokamakHost
13
-
14
- init(host: TokamakHost) { self.host = host }
15
-
16
- func callBytes(method: String, payload: Data, reply: @escaping TokamakPluginBytesReply)
17
- throws(TokamakPluginError) -> (() -> Void)?
18
- {
19
- let b = try TokamakBinding(payload, resources: host.resources, reply: reply)
20
- switch method {
21
- #if os(iOS)
22
- case "CLBackgroundActivitySession.init()":
23
- guard #available(iOS 17.0, *) else { throw TokamakBinding.unavailable }
24
- return b.run { let value = CLBackgroundActivitySession(); return b.encode(object: value) }
25
- #endif
26
- #if os(iOS)
27
- case "CLBackgroundActivitySession.invalidate()":
28
- guard #available(iOS 17.0, *) else { throw TokamakBinding.unavailable }
29
- return b.run { try b.target(CLBackgroundActivitySession.self).invalidate(); return nil }
30
- #endif
31
- case "CLBeacon.accuracy":
32
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
33
- return b.run { let value = try b.target(CLBeacon.self).accuracy; return b.encode(value) }
34
- case "CLBeacon.major":
35
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
36
- return b.run { let value = try b.target(CLBeacon.self).major; return b.encode(value) }
37
- case "CLBeacon.minor":
38
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
39
- return b.run { let value = try b.target(CLBeacon.self).minor; return b.encode(value) }
40
- case "CLBeacon.proximity":
41
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
42
- return b.run { let value = try b.target(CLBeacon.self).proximity; return TokamakBindings_location.encode(value, b) }
43
- case "CLBeacon.proximityUUID":
44
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
45
- return b.run { let value = try b.target(CLBeacon.self).proximityUUID; return b.encode(value) }
46
- case "CLBeacon.rssi":
47
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
48
- return b.run { let value = try b.target(CLBeacon.self).rssi; return b.encode(value) }
49
- case "CLBeacon.timestamp":
50
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
51
- return b.run { let value = try b.target(CLBeacon.self).timestamp; return b.encode(value) }
52
- case "CLBeacon.uuid":
53
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
54
- return b.run { let value = try b.target(CLBeacon.self).uuid; return b.encode(value) }
55
- case "CLBeaconIdentityConstraint.major":
56
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
57
- return b.run { let value = try b.target(CLBeaconIdentityConstraint.self).major; return b.encode(optional: value) { b.encode($0) } }
58
- case "CLBeaconIdentityConstraint.minor":
59
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
60
- return b.run { let value = try b.target(CLBeaconIdentityConstraint.self).minor; return b.encode(optional: value) { b.encode($0) } }
61
- case "CLBeaconRegion.beaconIdentityConstraint":
62
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
63
- return b.run { let value = try b.target(CLBeaconRegion.self).beaconIdentityConstraint; return b.encode(object: value) }
64
- case "CLBeaconRegion.init(beaconIdentityConstraint:identifier:)":
65
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
66
- return b.run { let value = try CLBeaconRegion(beaconIdentityConstraint: b.object(b[0], as: CLBeaconIdentityConstraint.self), identifier: b.decode(b[1], as: String.self)); return b.encode(object: value) }
67
- case "CLBeaconRegion.init(proximityUUID:identifier:)":
68
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
69
- return b.run { let value = try CLBeaconRegion(proximityUUID: b.decode(b[0], as: UUID.self), identifier: b.decode(b[1], as: String.self)); return b.encode(object: value) }
70
- case "CLBeaconRegion.init(proximityUUID:major:identifier:)":
71
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
72
- return b.run { let value = try CLBeaconRegion(proximityUUID: b.decode(b[0], as: UUID.self), major: b.decode(b[1], as: CLBeaconMajorValue.self), identifier: b.decode(b[2], as: String.self)); return b.encode(object: value) }
73
- case "CLBeaconRegion.init(proximityUUID:major:minor:identifier:)":
74
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
75
- return b.run { let value = try CLBeaconRegion(proximityUUID: b.decode(b[0], as: UUID.self), major: b.decode(b[1], as: CLBeaconMajorValue.self), minor: b.decode(b[2], as: CLBeaconMinorValue.self), identifier: b.decode(b[3], as: String.self)); return b.encode(object: value) }
76
- case "CLBeaconRegion.init(uuid:identifier:)":
77
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
78
- return b.run { let value = try CLBeaconRegion(uuid: b.decode(b[0], as: UUID.self), identifier: b.decode(b[1], as: String.self)); return b.encode(object: value) }
79
- case "CLBeaconRegion.init(uuid:major:identifier:)":
80
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
81
- return b.run { let value = try CLBeaconRegion(uuid: b.decode(b[0], as: UUID.self), major: b.decode(b[1], as: CLBeaconMajorValue.self), identifier: b.decode(b[2], as: String.self)); return b.encode(object: value) }
82
- case "CLBeaconRegion.init(uuid:major:minor:identifier:)":
83
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
84
- return b.run { let value = try CLBeaconRegion(uuid: b.decode(b[0], as: UUID.self), major: b.decode(b[1], as: CLBeaconMajorValue.self), minor: b.decode(b[2], as: CLBeaconMinorValue.self), identifier: b.decode(b[3], as: String.self)); return b.encode(object: value) }
85
- case "CLBeaconRegion.major":
86
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
87
- return b.run { let value = try b.target(CLBeaconRegion.self).major; return b.encode(optional: value) { b.encode($0) } }
88
- case "CLBeaconRegion.minor":
89
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
90
- return b.run { let value = try b.target(CLBeaconRegion.self).minor; return b.encode(optional: value) { b.encode($0) } }
91
- case "CLBeaconRegion.notifyEntryStateOnDisplay":
92
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
93
- return b.run { let value = try b.target(CLBeaconRegion.self).notifyEntryStateOnDisplay; return b.encode(value) }
94
- case "CLBeaconRegion.notifyEntryStateOnDisplay=":
95
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
96
- return b.run { try b.target(CLBeaconRegion.self).notifyEntryStateOnDisplay = b.decode(b[0], as: Bool.self); return nil }
97
- case "CLBeaconRegion.proximityUUID":
98
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
99
- return b.run { let value = try b.target(CLBeaconRegion.self).proximityUUID; return b.encode(value) }
100
- case "CLBeaconRegion.uuid":
101
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
102
- return b.run { let value = try b.target(CLBeaconRegion.self).uuid; return b.encode(value) }
103
- case "CLCircularRegion.center":
104
- guard #available(iOS 7.0, macOS 10.10, *) else { throw TokamakBinding.unavailable }
105
- return b.run { let value = try b.target(CLCircularRegion.self).center; return TokamakBindings_location.encode(value, b) }
106
- case "CLCircularRegion.contains(_:)":
107
- guard #available(iOS 7.0, macOS 10.10, *) else { throw TokamakBinding.unavailable }
108
- return b.run { let value = try b.target(CLCircularRegion.self).contains(TokamakBindings_location.decode(b[0], b, as: CLLocationCoordinate2D.self)); return b.encode(value) }
109
- case "CLCircularRegion.init(center:radius:identifier:)":
110
- guard #available(iOS 7.0, macOS 10.10, *) else { throw TokamakBinding.unavailable }
111
- return b.run { let value = try CLCircularRegion(center: TokamakBindings_location.decode(b[0], b, as: CLLocationCoordinate2D.self), radius: b.decode(b[1], as: CLLocationDistance.self), identifier: b.decode(b[2], as: String.self)); return b.encode(object: value) }
112
- case "CLCircularRegion.radius":
113
- guard #available(iOS 7.0, macOS 10.10, *) else { throw TokamakBinding.unavailable }
114
- return b.run { let value = try b.target(CLCircularRegion.self).radius; return b.encode(value) }
115
- case "CLGeocoder.cancelGeocode()":
116
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
117
- return b.run { try b.target(CLGeocoder.self).cancelGeocode(); return nil }
118
- case "CLGeocoder.geocodeAddressString(_:)":
119
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
120
- return b.task { let value = try await b.target(CLGeocoder.self).geocodeAddressString(b.decode(b[0], as: String.self)); return b.encode(array: value) { b.encode(object: $0) } }
121
- case "CLGeocoder.geocodeAddressString(_:in:)":
122
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
123
- return b.task { let value = try await b.target(CLGeocoder.self).geocodeAddressString(b.decode(b[0], as: String.self), in: b.optional(b[1]) { try b.object($0, as: CLRegion.self) }); return b.encode(array: value) { b.encode(object: $0) } }
124
- case "CLGeocoder.geocodeAddressString(_:in:preferredLocale:)":
125
- guard #available(iOS 11.0, macOS 10.13, *) else { throw TokamakBinding.unavailable }
126
- return b.task { let value = try await b.target(CLGeocoder.self).geocodeAddressString(b.decode(b[0], as: String.self), in: b.optional(b[1]) { try b.object($0, as: CLRegion.self) }, preferredLocale: b.optional(b[2]) { try b.decode($0, as: Locale.self) }); return b.encode(array: value) { b.encode(object: $0) } }
127
- case "CLGeocoder.isGeocoding":
128
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
129
- return b.run { let value = try b.target(CLGeocoder.self).isGeocoding; return b.encode(value) }
130
- case "CLGeocoder.reverseGeocodeLocation(_:)":
131
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
132
- return b.task { let value = try await b.target(CLGeocoder.self).reverseGeocodeLocation(b.object(b[0], as: CLLocation.self)); return b.encode(array: value) { b.encode(object: $0) } }
133
- case "CLGeocoder.reverseGeocodeLocation(_:preferredLocale:)":
134
- guard #available(iOS 11.0, macOS 10.13, *) else { throw TokamakBinding.unavailable }
135
- return b.task { let value = try await b.target(CLGeocoder.self).reverseGeocodeLocation(b.object(b[0], as: CLLocation.self), preferredLocale: b.optional(b[1]) { try b.decode($0, as: Locale.self) }); return b.encode(array: value) { b.encode(object: $0) } }
136
- case "CLGeocoder.init()":
137
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
138
- return b.run { let value = CLGeocoder(); return b.encode(object: value) }
139
- case "CLHeading.headingAccuracy":
140
- guard #available(iOS 3.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
141
- return b.run { let value = try b.target(CLHeading.self).headingAccuracy; return b.encode(value) }
142
- case "CLHeading.magneticHeading":
143
- guard #available(iOS 3.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
144
- return b.run { let value = try b.target(CLHeading.self).magneticHeading; return b.encode(value) }
145
- case "CLHeading.timestamp":
146
- guard #available(iOS 3.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
147
- return b.run { let value = try b.target(CLHeading.self).timestamp; return b.encode(value) }
148
- case "CLHeading.trueHeading":
149
- guard #available(iOS 3.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
150
- return b.run { let value = try b.target(CLHeading.self).trueHeading; return b.encode(value) }
151
- case "CLHeading.x":
152
- guard #available(iOS 3.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
153
- return b.run { let value = try b.target(CLHeading.self).x; return b.encode(value) }
154
- case "CLHeading.y":
155
- guard #available(iOS 3.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
156
- return b.run { let value = try b.target(CLHeading.self).y; return b.encode(value) }
157
- case "CLHeading.z":
158
- guard #available(iOS 3.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
159
- return b.run { let value = try b.target(CLHeading.self).z; return b.encode(value) }
160
- case "CLLocationManager.accuracyAuthorization":
161
- guard #available(iOS 14.0, macOS 11.0, *) else { throw TokamakBinding.unavailable }
162
- return b.run { let value = try b.target(CLLocationManager.self).accuracyAuthorization; return TokamakBindings_location.encode(value, b) }
163
- case "CLLocationManager.activityType":
164
- guard #available(iOS 6.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
165
- return b.run { let value = try b.target(CLLocationManager.self).activityType; return TokamakBindings_location.encode(value, b) }
166
- case "CLLocationManager.activityType=":
167
- guard #available(iOS 6.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
168
- return b.run { try b.target(CLLocationManager.self).activityType = TokamakBindings_location.decode(b[0], b, as: CLActivityType.self); return nil }
169
- case "CLLocationManager.allowDeferredLocationUpdates(untilTraveled:timeout:)":
170
- guard #available(iOS 6.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
171
- return b.run { try b.target(CLLocationManager.self).allowDeferredLocationUpdates(untilTraveled: b.decode(b[0], as: CLLocationDistance.self), timeout: b.decode(b[1], as: TimeInterval.self)); return nil }
172
- case "CLLocationManager.allowsBackgroundLocationUpdates":
173
- guard #available(iOS 9.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
174
- return b.run { let value = try b.target(CLLocationManager.self).allowsBackgroundLocationUpdates; return b.encode(value) }
175
- case "CLLocationManager.allowsBackgroundLocationUpdates=":
176
- guard #available(iOS 9.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
177
- return b.run { try b.target(CLLocationManager.self).allowsBackgroundLocationUpdates = b.decode(b[0], as: Bool.self); return nil }
178
- case "CLLocationManager.authorizationStatus":
179
- guard #available(iOS 14.0, macOS 11.0, *) else { throw TokamakBinding.unavailable }
180
- return b.run { let value = try b.target(CLLocationManager.self).authorizationStatus; return TokamakBindings_location.encode(value, b) }
181
- case "CLLocationManager.authorizationStatus()":
182
- guard #available(iOS 4.2, macOS 10.7, *) else { throw TokamakBinding.unavailable }
183
- return b.run { let value = CLLocationManager.authorizationStatus(); return TokamakBindings_location.encode(value, b) }
184
- case "CLLocationManager.deferredLocationUpdatesAvailable()":
185
- guard #available(iOS 6.0, macOS 10.9, *) else { throw TokamakBinding.unavailable }
186
- return b.run { let value = CLLocationManager.deferredLocationUpdatesAvailable(); return b.encode(value) }
187
- case "CLLocationManager.delegate":
188
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
189
- return b.run { let value = try b.target(CLLocationManager.self).delegate; return b.encode(optional: value) { b.encode(object: $0) } }
190
- case "CLLocationManager.delegate=":
191
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
192
- return b.run { try b.target(CLLocationManager.self).delegate = b.optional(b[0]) { try b.object($0, as: (any CLLocationManagerDelegate).self) }; return nil }
193
- case "CLLocationManager.desiredAccuracy":
194
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
195
- return b.run { let value = try b.target(CLLocationManager.self).desiredAccuracy; return b.encode(value) }
196
- case "CLLocationManager.desiredAccuracy=":
197
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
198
- return b.run { try b.target(CLLocationManager.self).desiredAccuracy = b.decode(b[0], as: CLLocationAccuracy.self); return nil }
199
- case "CLLocationManager.disallowDeferredLocationUpdates()":
200
- guard #available(iOS 6.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
201
- return b.run { try b.target(CLLocationManager.self).disallowDeferredLocationUpdates(); return nil }
202
- case "CLLocationManager.dismissHeadingCalibrationDisplay()":
203
- guard #available(iOS 3.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
204
- return b.run { try b.target(CLLocationManager.self).dismissHeadingCalibrationDisplay(); return nil }
205
- case "CLLocationManager.distanceFilter":
206
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
207
- return b.run { let value = try b.target(CLLocationManager.self).distanceFilter; return b.encode(value) }
208
- case "CLLocationManager.distanceFilter=":
209
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
210
- return b.run { try b.target(CLLocationManager.self).distanceFilter = b.decode(b[0], as: CLLocationDistance.self); return nil }
211
- case "CLLocationManager.heading":
212
- guard #available(iOS 4.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
213
- return b.run { let value = try b.target(CLLocationManager.self).heading; return b.encode(optional: value) { b.encode(object: $0) } }
214
- case "CLLocationManager.headingAvailable()":
215
- guard #available(iOS 4.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
216
- return b.run { let value = CLLocationManager.headingAvailable(); return b.encode(value) }
217
- case "CLLocationManager.headingFilter":
218
- guard #available(iOS 3.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
219
- return b.run { let value = try b.target(CLLocationManager.self).headingFilter; return b.encode(value) }
220
- case "CLLocationManager.headingFilter=":
221
- guard #available(iOS 3.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
222
- return b.run { try b.target(CLLocationManager.self).headingFilter = b.decode(b[0], as: CLLocationDegrees.self); return nil }
223
- case "CLLocationManager.headingOrientation":
224
- guard #available(iOS 4.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
225
- return b.run { let value = try b.target(CLLocationManager.self).headingOrientation; return TokamakBindings_location.encode(value, b) }
226
- case "CLLocationManager.headingOrientation=":
227
- guard #available(iOS 4.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
228
- return b.run { try b.target(CLLocationManager.self).headingOrientation = TokamakBindings_location.decode(b[0], b, as: CLDeviceOrientation.self); return nil }
229
- case "CLLocationManager.isAuthorizedForWidgetUpdates":
230
- guard #available(iOS 14.0, macOS 11.0, *) else { throw TokamakBinding.unavailable }
231
- return b.run { let value = try b.target(CLLocationManager.self).isAuthorizedForWidgetUpdates; return b.encode(value) }
232
- case "CLLocationManager.isRangingAvailable()":
233
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
234
- return b.run { let value = CLLocationManager.isRangingAvailable(); return b.encode(value) }
235
- case "CLLocationManager.location":
236
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
237
- return b.run { let value = try b.target(CLLocationManager.self).location; return b.encode(optional: value) { b.encode(object: $0) } }
238
- case "CLLocationManager.locationServicesEnabled()":
239
- guard #available(iOS 4.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
240
- return b.run { let value = CLLocationManager.locationServicesEnabled(); return b.encode(value) }
241
- case "CLLocationManager.maximumRegionMonitoringDistance":
242
- guard #available(iOS 4.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
243
- return b.run { let value = try b.target(CLLocationManager.self).maximumRegionMonitoringDistance; return b.encode(value) }
244
- case "CLLocationManager.monitoredRegions":
245
- guard #available(iOS 4.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
246
- return b.run { let value = try b.target(CLLocationManager.self).monitoredRegions; return b.encode(array: value) { b.encode(object: $0) } }
247
- case "CLLocationManager.pausesLocationUpdatesAutomatically":
248
- guard #available(iOS 6.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
249
- return b.run { let value = try b.target(CLLocationManager.self).pausesLocationUpdatesAutomatically; return b.encode(value) }
250
- case "CLLocationManager.pausesLocationUpdatesAutomatically=":
251
- guard #available(iOS 6.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
252
- return b.run { try b.target(CLLocationManager.self).pausesLocationUpdatesAutomatically = b.decode(b[0], as: Bool.self); return nil }
253
- case "CLLocationManager.rangedBeaconConstraints":
254
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
255
- return b.run { let value = try b.target(CLLocationManager.self).rangedBeaconConstraints; return b.encode(array: value) { b.encode(object: $0) } }
256
- case "CLLocationManager.rangedRegions":
257
- guard #available(iOS 7.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
258
- return b.run { let value = try b.target(CLLocationManager.self).rangedRegions; return b.encode(array: value) { b.encode(object: $0) } }
259
- case "CLLocationManager.requestAlwaysAuthorization()":
260
- guard #available(iOS 8.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
261
- return b.run { try b.target(CLLocationManager.self).requestAlwaysAuthorization(); return nil }
262
- case "CLLocationManager.requestLocation()":
263
- guard #available(iOS 9.0, macOS 10.14, *) else { throw TokamakBinding.unavailable }
264
- return b.run { try b.target(CLLocationManager.self).requestLocation(); return nil }
265
- case "CLLocationManager.requestState(for:)":
266
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
267
- return b.run { try b.target(CLLocationManager.self).requestState(for: b.object(b[0], as: CLRegion.self)); return nil }
268
- case "CLLocationManager.requestTemporaryFullAccuracyAuthorization(withPurposeKey:)":
269
- guard #available(iOS 14.0, macOS 11.0, *) else { throw TokamakBinding.unavailable }
270
- return b.task { try await b.target(CLLocationManager.self).requestTemporaryFullAccuracyAuthorization(withPurposeKey: b.decode(b[0], as: String.self)); return nil }
271
- case "CLLocationManager.requestWhenInUseAuthorization()":
272
- guard #available(iOS 8.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
273
- return b.run { try b.target(CLLocationManager.self).requestWhenInUseAuthorization(); return nil }
274
- #if os(iOS)
275
- case "CLLocationManager.showsBackgroundLocationIndicator":
276
- guard #available(iOS 11.0, *) else { throw TokamakBinding.unavailable }
277
- return b.run { let value = try b.target(CLLocationManager.self).showsBackgroundLocationIndicator; return b.encode(value) }
278
- #endif
279
- #if os(iOS)
280
- case "CLLocationManager.showsBackgroundLocationIndicator=":
281
- guard #available(iOS 11.0, *) else { throw TokamakBinding.unavailable }
282
- return b.run { try b.target(CLLocationManager.self).showsBackgroundLocationIndicator = b.decode(b[0], as: Bool.self); return nil }
283
- #endif
284
- case "CLLocationManager.significantLocationChangeMonitoringAvailable()":
285
- guard #available(iOS 4.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
286
- return b.run { let value = CLLocationManager.significantLocationChangeMonitoringAvailable(); return b.encode(value) }
287
- case "CLLocationManager.startMonitoring(for:)":
288
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
289
- return b.run { try b.target(CLLocationManager.self).startMonitoring(for: b.object(b[0], as: CLRegion.self)); return nil }
290
- #if os(iOS)
291
- case "CLLocationManager.startMonitoringLocationPushes()":
292
- guard #available(iOS 15.0, *) else { throw TokamakBinding.unavailable }
293
- return b.task { let value = try await b.target(CLLocationManager.self).startMonitoringLocationPushes(); return b.encode(value) }
294
- #endif
295
- case "CLLocationManager.startMonitoringSignificantLocationChanges()":
296
- guard #available(iOS 4.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
297
- return b.run { try b.target(CLLocationManager.self).startMonitoringSignificantLocationChanges(); return nil }
298
- case "CLLocationManager.startMonitoringVisits()":
299
- guard #available(iOS 8.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
300
- return b.run { try b.target(CLLocationManager.self).startMonitoringVisits(); return nil }
301
- case "CLLocationManager.startRangingBeacons(in:)":
302
- guard #available(iOS 7.0, macOS 11.0, *) else { throw TokamakBinding.unavailable }
303
- return b.run { try b.target(CLLocationManager.self).startRangingBeacons(in: b.object(b[0], as: CLBeaconRegion.self)); return nil }
304
- case "CLLocationManager.startRangingBeacons(satisfying:)":
305
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
306
- return b.run { try b.target(CLLocationManager.self).startRangingBeacons(satisfying: b.object(b[0], as: CLBeaconIdentityConstraint.self)); return nil }
307
- case "CLLocationManager.startUpdatingHeading()":
308
- guard #available(iOS 3.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
309
- return b.run { try b.target(CLLocationManager.self).startUpdatingHeading(); return nil }
310
- case "CLLocationManager.startUpdatingLocation()":
311
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
312
- return b.run { try b.target(CLLocationManager.self).startUpdatingLocation(); return nil }
313
- case "CLLocationManager.stopMonitoring(for:)":
314
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
315
- return b.run { try b.target(CLLocationManager.self).stopMonitoring(for: b.object(b[0], as: CLRegion.self)); return nil }
316
- #if os(iOS)
317
- case "CLLocationManager.stopMonitoringLocationPushes()":
318
- guard #available(iOS 15.0, *) else { throw TokamakBinding.unavailable }
319
- return b.run { try b.target(CLLocationManager.self).stopMonitoringLocationPushes(); return nil }
320
- #endif
321
- case "CLLocationManager.stopMonitoringSignificantLocationChanges()":
322
- guard #available(iOS 4.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
323
- return b.run { try b.target(CLLocationManager.self).stopMonitoringSignificantLocationChanges(); return nil }
324
- case "CLLocationManager.stopMonitoringVisits()":
325
- guard #available(iOS 8.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
326
- return b.run { try b.target(CLLocationManager.self).stopMonitoringVisits(); return nil }
327
- case "CLLocationManager.stopRangingBeacons(in:)":
328
- guard #available(iOS 7.0, macOS 11.0, *) else { throw TokamakBinding.unavailable }
329
- return b.run { try b.target(CLLocationManager.self).stopRangingBeacons(in: b.object(b[0], as: CLBeaconRegion.self)); return nil }
330
- case "CLLocationManager.stopRangingBeacons(satisfying:)":
331
- guard #available(iOS 13.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
332
- return b.run { try b.target(CLLocationManager.self).stopRangingBeacons(satisfying: b.object(b[0], as: CLBeaconIdentityConstraint.self)); return nil }
333
- #if os(iOS)
334
- case "CLLocationManager.stopUpdatingHeading()":
335
- guard #available(iOS 3.0, *) else { throw TokamakBinding.unavailable }
336
- return b.run { try b.target(CLLocationManager.self).stopUpdatingHeading(); return nil }
337
- #endif
338
- case "CLLocationManager.stopUpdatingLocation()":
339
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
340
- return b.run { try b.target(CLLocationManager.self).stopUpdatingLocation(); return nil }
341
- #if os(macOS)
342
- case "CLLocationManager.headingAvailable":
343
- guard #available(macOS 10.15, *) else { throw TokamakBinding.unavailable }
344
- return b.run { let value = try b.target(CLLocationManager.self).headingAvailable; return b.encode(value) }
345
- #endif
346
- #if os(macOS)
347
- case "CLLocationManager.locationServicesEnabled":
348
- guard #available(macOS 10.15, *) else { throw TokamakBinding.unavailable }
349
- return b.run { let value = try b.target(CLLocationManager.self).locationServicesEnabled; return b.encode(value) }
350
- #endif
351
- #if os(macOS)
352
- case "CLLocationManager.purpose":
353
- guard #available(macOS 10.7, *) else { throw TokamakBinding.unavailable }
354
- return b.run { let value = try b.target(CLLocationManager.self).purpose; return b.encode(optional: value) { b.encode($0) } }
355
- #endif
356
- #if os(macOS)
357
- case "CLLocationManager.purpose=":
358
- guard #available(macOS 10.7, *) else { throw TokamakBinding.unavailable }
359
- return b.run { try b.target(CLLocationManager.self).purpose = b.optional(b[0]) { try b.decode($0, as: String.self) }; return nil }
360
- #endif
361
- #if os(macOS)
362
- case "CLLocationManager.regionMonitoringAvailable()":
363
- guard #available(macOS 10.8, *) else { throw TokamakBinding.unavailable }
364
- return b.run { let value = CLLocationManager.regionMonitoringAvailable(); return b.encode(value) }
365
- #endif
366
- #if os(macOS)
367
- case "CLLocationManager.regionMonitoringEnabled()":
368
- guard #available(macOS 10.8, *) else { throw TokamakBinding.unavailable }
369
- return b.run { let value = CLLocationManager.regionMonitoringEnabled(); return b.encode(value) }
370
- #endif
371
- #if os(macOS)
372
- case "CLLocationManager.startMonitoring(for:desiredAccuracy:)":
373
- guard #available(macOS 10.15, *) else { throw TokamakBinding.unavailable }
374
- return b.run { try b.target(CLLocationManager.self).startMonitoring(for: b.object(b[0], as: CLRegion.self), desiredAccuracy: b.decode(b[1], as: CLLocationAccuracy.self)); return nil }
375
- #endif
376
- case "CLLocationManager.init()":
377
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
378
- return b.run { let value = CLLocationManager(); return b.encode(object: value) }
379
- case "CLMonitor.add(_:identifier:)":
380
- guard #available(iOS 17.0, macOS 14.0, *) else { throw TokamakBinding.unavailable }
381
- return b.task { try await b.target(CLMonitor.self).add(b.object(b[0], as: (any CLCondition).self), identifier: b.decode(b[1], as: String.self)); return nil }
382
- case "CLMonitor.identifiers":
383
- guard #available(iOS 17.0, macOS 14.0, *) else { throw TokamakBinding.unavailable }
384
- return b.task { let value = try await b.target(CLMonitor.self).identifiers; return b.encode(array: value) { b.encode($0) } }
385
- case "CLMonitor.init(_:)":
386
- guard #available(iOS 17.0, macOS 14.0, *) else { throw TokamakBinding.unavailable }
387
- return b.task { let value = try await CLMonitor(b.decode(b[0], as: String.self)); return b.encode(object: value) }
388
- case "CLMonitor.remove(_:)":
389
- guard #available(iOS 17.0, macOS 14.0, *) else { throw TokamakBinding.unavailable }
390
- return b.task { try await b.target(CLMonitor.self).remove(b.decode(b[0], as: String.self)); return nil }
391
- case "CLPlacemark.administrativeArea":
392
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
393
- return b.run { let value = try b.target(CLPlacemark.self).administrativeArea; return b.encode(optional: value) { b.encode($0) } }
394
- case "CLPlacemark.areasOfInterest":
395
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
396
- return b.run { let value = try b.target(CLPlacemark.self).areasOfInterest; return b.encode(optional: value) { b.encode(array: $0) { b.encode($0) } } }
397
- case "CLPlacemark.country":
398
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
399
- return b.run { let value = try b.target(CLPlacemark.self).country; return b.encode(optional: value) { b.encode($0) } }
400
- case "CLPlacemark.init(placemark:)":
401
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
402
- return b.run { let value = try CLPlacemark(placemark: b.object(b[0], as: CLPlacemark.self)); return b.encode(object: value) }
403
- case "CLPlacemark.inlandWater":
404
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
405
- return b.run { let value = try b.target(CLPlacemark.self).inlandWater; return b.encode(optional: value) { b.encode($0) } }
406
- case "CLPlacemark.isoCountryCode":
407
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
408
- return b.run { let value = try b.target(CLPlacemark.self).isoCountryCode; return b.encode(optional: value) { b.encode($0) } }
409
- case "CLPlacemark.locality":
410
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
411
- return b.run { let value = try b.target(CLPlacemark.self).locality; return b.encode(optional: value) { b.encode($0) } }
412
- case "CLPlacemark.location":
413
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
414
- return b.run { let value = try b.target(CLPlacemark.self).location; return b.encode(optional: value) { b.encode(object: $0) } }
415
- case "CLPlacemark.name":
416
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
417
- return b.run { let value = try b.target(CLPlacemark.self).name; return b.encode(optional: value) { b.encode($0) } }
418
- case "CLPlacemark.ocean":
419
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
420
- return b.run { let value = try b.target(CLPlacemark.self).ocean; return b.encode(optional: value) { b.encode($0) } }
421
- case "CLPlacemark.postalCode":
422
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
423
- return b.run { let value = try b.target(CLPlacemark.self).postalCode; return b.encode(optional: value) { b.encode($0) } }
424
- case "CLPlacemark.region":
425
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
426
- return b.run { let value = try b.target(CLPlacemark.self).region; return b.encode(optional: value) { b.encode(object: $0) } }
427
- case "CLPlacemark.subAdministrativeArea":
428
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
429
- return b.run { let value = try b.target(CLPlacemark.self).subAdministrativeArea; return b.encode(optional: value) { b.encode($0) } }
430
- case "CLPlacemark.subLocality":
431
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
432
- return b.run { let value = try b.target(CLPlacemark.self).subLocality; return b.encode(optional: value) { b.encode($0) } }
433
- case "CLPlacemark.subThoroughfare":
434
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
435
- return b.run { let value = try b.target(CLPlacemark.self).subThoroughfare; return b.encode(optional: value) { b.encode($0) } }
436
- case "CLPlacemark.thoroughfare":
437
- guard #available(iOS 5.0, macOS 10.8, *) else { throw TokamakBinding.unavailable }
438
- return b.run { let value = try b.target(CLPlacemark.self).thoroughfare; return b.encode(optional: value) { b.encode($0) } }
439
- case "CLPlacemark.timeZone":
440
- guard #available(iOS 9.0, macOS 10.11, *) else { throw TokamakBinding.unavailable }
441
- return b.run { let value = try b.target(CLPlacemark.self).timeZone; return b.encode(optional: value) { b.encode($0) } }
442
- case "CLRegion.identifier":
443
- guard #available(iOS 4.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
444
- return b.run { let value = try b.target(CLRegion.self).identifier; return b.encode(value) }
445
- case "CLRegion.notifyOnEntry":
446
- guard #available(iOS 7.0, macOS 10.10, *) else { throw TokamakBinding.unavailable }
447
- return b.run { let value = try b.target(CLRegion.self).notifyOnEntry; return b.encode(value) }
448
- case "CLRegion.notifyOnEntry=":
449
- guard #available(iOS 7.0, macOS 10.10, *) else { throw TokamakBinding.unavailable }
450
- return b.run { try b.target(CLRegion.self).notifyOnEntry = b.decode(b[0], as: Bool.self); return nil }
451
- case "CLRegion.notifyOnExit":
452
- guard #available(iOS 7.0, macOS 10.10, *) else { throw TokamakBinding.unavailable }
453
- return b.run { let value = try b.target(CLRegion.self).notifyOnExit; return b.encode(value) }
454
- case "CLRegion.notifyOnExit=":
455
- guard #available(iOS 7.0, macOS 10.10, *) else { throw TokamakBinding.unavailable }
456
- return b.run { try b.target(CLRegion.self).notifyOnExit = b.decode(b[0], as: Bool.self); return nil }
457
- #if os(macOS)
458
- case "CLRegion.center":
459
- guard #available(macOS 10.7, *) else { throw TokamakBinding.unavailable }
460
- return b.run { let value = try b.target(CLRegion.self).center; return TokamakBindings_location.encode(value, b) }
461
- #endif
462
- #if os(macOS)
463
- case "CLRegion.contains(_:)":
464
- guard #available(macOS 10.7, *) else { throw TokamakBinding.unavailable }
465
- return b.run { let value = try b.target(CLRegion.self).contains(TokamakBindings_location.decode(b[0], b, as: CLLocationCoordinate2D.self)); return b.encode(value) }
466
- #endif
467
- #if os(macOS)
468
- case "CLRegion.init(circularRegionWithCenter:radius:identifier:)":
469
- guard #available(macOS 10.7, *) else { throw TokamakBinding.unavailable }
470
- return b.run { let value = try CLRegion(circularRegionWithCenter: TokamakBindings_location.decode(b[0], b, as: CLLocationCoordinate2D.self), radius: b.decode(b[1], as: CLLocationDistance.self), identifier: b.decode(b[2], as: String.self)); return b.encode(object: value) }
471
- #endif
472
- #if os(macOS)
473
- case "CLRegion.radius":
474
- guard #available(macOS 10.7, *) else { throw TokamakBinding.unavailable }
475
- return b.run { let value = try b.target(CLRegion.self).radius; return b.encode(value) }
476
- #endif
477
- #if os(iOS)
478
- case "CLServiceSession.init(authorization:)":
479
- guard #available(iOS 18.0, *) else { throw TokamakBinding.unavailable }
480
- return b.run { let value = try CLServiceSession(authorization: TokamakBindings_location.decode(b[0], b, as: CLServiceSession.AuthorizationRequirement.self)); return b.encode(object: value) }
481
- #endif
482
- #if os(iOS)
483
- case "CLServiceSession.init(authorization:fullAccuracyPurposeKey:)":
484
- guard #available(iOS 18.0, *) else { throw TokamakBinding.unavailable }
485
- return b.run { let value = try CLServiceSession(authorization: TokamakBindings_location.decode(b[0], b, as: CLServiceSession.AuthorizationRequirement.self), fullAccuracyPurposeKey: b.decode(b[1], as: String.self)); return b.encode(object: value) }
486
- #endif
487
- #if os(iOS)
488
- case "CLServiceSession.invalidate()":
489
- guard #available(iOS 18.0, *) else { throw TokamakBinding.unavailable }
490
- return b.run { try b.target(CLServiceSession.self).invalidate(); return nil }
491
- #endif
492
- case "CLVisit.arrivalDate":
493
- guard #available(iOS 8.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
494
- return b.run { let value = try b.target(CLVisit.self).arrivalDate; return b.encode(value) }
495
- case "CLVisit.coordinate":
496
- guard #available(iOS 8.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
497
- return b.run { let value = try b.target(CLVisit.self).coordinate; return TokamakBindings_location.encode(value, b) }
498
- case "CLVisit.departureDate":
499
- guard #available(iOS 8.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
500
- return b.run { let value = try b.target(CLVisit.self).departureDate; return b.encode(value) }
501
- case "CLVisit.horizontalAccuracy":
502
- guard #available(iOS 8.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
503
- return b.run { let value = try b.target(CLVisit.self).horizontalAccuracy; return b.encode(value) }
504
- case "CLFloor.level":
505
- guard #available(iOS 8.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
506
- return b.run { let value = try b.target(CLFloor.self).level; return b.encode(value) }
507
- case "CLLocation.altitude":
508
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
509
- return b.run { let value = try b.target(CLLocation.self).altitude; return b.encode(value) }
510
- case "CLLocation.coordinate":
511
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
512
- return b.run { let value = try b.target(CLLocation.self).coordinate; return TokamakBindings_location.encode(value, b) }
513
- case "CLLocation.course":
514
- guard #available(iOS 2.2, macOS 10.7, *) else { throw TokamakBinding.unavailable }
515
- return b.run { let value = try b.target(CLLocation.self).course; return b.encode(value) }
516
- case "CLLocation.courseAccuracy":
517
- guard #available(iOS 13.4, macOS 10.15.4, *) else { throw TokamakBinding.unavailable }
518
- return b.run { let value = try b.target(CLLocation.self).courseAccuracy; return b.encode(value) }
519
- case "CLLocation.distance(from:)":
520
- guard #available(iOS 3.2, macOS 10.6, *) else { throw TokamakBinding.unavailable }
521
- return b.run { let value = try b.target(CLLocation.self).distance(from: b.object(b[0], as: CLLocation.self)); return b.encode(value) }
522
- case "CLLocation.ellipsoidalAltitude":
523
- guard #available(iOS 15.0, macOS 12.0, *) else { throw TokamakBinding.unavailable }
524
- return b.run { let value = try b.target(CLLocation.self).ellipsoidalAltitude; return b.encode(value) }
525
- case "CLLocation.floor":
526
- guard #available(iOS 8.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
527
- return b.run { let value = try b.target(CLLocation.self).floor; return b.encode(optional: value) { b.encode(object: $0) } }
528
- case "CLLocation.horizontalAccuracy":
529
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
530
- return b.run { let value = try b.target(CLLocation.self).horizontalAccuracy; return b.encode(value) }
531
- case "CLLocation.init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:course:courseAccuracy:speed:speedAccuracy:timestamp:)":
532
- guard #available(iOS 13.4, macOS 10.15.4, *) else { throw TokamakBinding.unavailable }
533
- return b.run { let value = try CLLocation(coordinate: TokamakBindings_location.decode(b[0], b, as: CLLocationCoordinate2D.self), altitude: b.decode(b[1], as: CLLocationDistance.self), horizontalAccuracy: b.decode(b[2], as: CLLocationAccuracy.self), verticalAccuracy: b.decode(b[3], as: CLLocationAccuracy.self), course: b.decode(b[4], as: CLLocationDirection.self), courseAccuracy: b.decode(b[5], as: CLLocationDirectionAccuracy.self), speed: b.decode(b[6], as: CLLocationSpeed.self), speedAccuracy: b.decode(b[7], as: CLLocationSpeedAccuracy.self), timestamp: b.decode(b[8], as: Date.self)); return b.encode(object: value) }
534
- case "CLLocation.init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:course:courseAccuracy:speed:speedAccuracy:timestamp:sourceInfo:)":
535
- guard #available(iOS 15.0, macOS 12.0, *) else { throw TokamakBinding.unavailable }
536
- return b.run { let value = try CLLocation(coordinate: TokamakBindings_location.decode(b[0], b, as: CLLocationCoordinate2D.self), altitude: b.decode(b[1], as: CLLocationDistance.self), horizontalAccuracy: b.decode(b[2], as: CLLocationAccuracy.self), verticalAccuracy: b.decode(b[3], as: CLLocationAccuracy.self), course: b.decode(b[4], as: CLLocationDirection.self), courseAccuracy: b.decode(b[5], as: CLLocationDirectionAccuracy.self), speed: b.decode(b[6], as: CLLocationSpeed.self), speedAccuracy: b.decode(b[7], as: CLLocationSpeedAccuracy.self), timestamp: b.decode(b[8], as: Date.self), sourceInfo: b.object(b[9], as: CLLocationSourceInformation.self)); return b.encode(object: value) }
537
- case "CLLocation.init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:course:speed:timestamp:)":
538
- guard #available(iOS 4.2, macOS 10.7, *) else { throw TokamakBinding.unavailable }
539
- return b.run { let value = try CLLocation(coordinate: TokamakBindings_location.decode(b[0], b, as: CLLocationCoordinate2D.self), altitude: b.decode(b[1], as: CLLocationDistance.self), horizontalAccuracy: b.decode(b[2], as: CLLocationAccuracy.self), verticalAccuracy: b.decode(b[3], as: CLLocationAccuracy.self), course: b.decode(b[4], as: CLLocationDirection.self), speed: b.decode(b[5], as: CLLocationSpeed.self), timestamp: b.decode(b[6], as: Date.self)); return b.encode(object: value) }
540
- case "CLLocation.init(coordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:)":
541
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
542
- return b.run { let value = try CLLocation(coordinate: TokamakBindings_location.decode(b[0], b, as: CLLocationCoordinate2D.self), altitude: b.decode(b[1], as: CLLocationDistance.self), horizontalAccuracy: b.decode(b[2], as: CLLocationAccuracy.self), verticalAccuracy: b.decode(b[3], as: CLLocationAccuracy.self), timestamp: b.decode(b[4], as: Date.self)); return b.encode(object: value) }
543
- case "CLLocation.init(latitude:longitude:)":
544
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
545
- return b.run { let value = try CLLocation(latitude: b.decode(b[0], as: CLLocationDegrees.self), longitude: b.decode(b[1], as: CLLocationDegrees.self)); return b.encode(object: value) }
546
- case "CLLocation.sourceInformation":
547
- guard #available(iOS 15.0, macOS 12.0, *) else { throw TokamakBinding.unavailable }
548
- return b.run { let value = try b.target(CLLocation.self).sourceInformation; return b.encode(optional: value) { b.encode(object: $0) } }
549
- case "CLLocation.speed":
550
- guard #available(iOS 2.2, macOS 10.7, *) else { throw TokamakBinding.unavailable }
551
- return b.run { let value = try b.target(CLLocation.self).speed; return b.encode(value) }
552
- case "CLLocation.speedAccuracy":
553
- guard #available(iOS 10.0, macOS 10.15, *) else { throw TokamakBinding.unavailable }
554
- return b.run { let value = try b.target(CLLocation.self).speedAccuracy; return b.encode(value) }
555
- case "CLLocation.timestamp":
556
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
557
- return b.run { let value = try b.target(CLLocation.self).timestamp; return b.encode(value) }
558
- case "CLLocation.verticalAccuracy":
559
- guard #available(iOS 2.0, macOS 10.6, *) else { throw TokamakBinding.unavailable }
560
- return b.run { let value = try b.target(CLLocation.self).verticalAccuracy; return b.encode(value) }
561
- #if os(macOS)
562
- case "CLLocation.getDistanceFrom(_:)":
563
- guard #available(macOS 10.15, *) else { throw TokamakBinding.unavailable }
564
- return b.run { let value = try b.target(CLLocation.self).getDistanceFrom(b.object(b[0], as: CLLocation.self)); return b.encode(value) }
565
- #endif
566
- case "CLLocationSourceInformation.init(softwareSimulationState:andExternalAccessoryState:)":
567
- guard #available(iOS 15.0, macOS 12.0, *) else { throw TokamakBinding.unavailable }
568
- return b.run { let value = try CLLocationSourceInformation(softwareSimulationState: b.decode(b[0], as: Bool.self), andExternalAccessoryState: b.decode(b[1], as: Bool.self)); return b.encode(object: value) }
569
- case "CLLocationSourceInformation.isProducedByAccessory":
570
- guard #available(iOS 15.0, macOS 12.0, *) else { throw TokamakBinding.unavailable }
571
- return b.run { let value = try b.target(CLLocationSourceInformation.self).isProducedByAccessory; return b.encode(value) }
572
- case "CLLocationSourceInformation.isSimulatedBySoftware":
573
- guard #available(iOS 15.0, macOS 12.0, *) else { throw TokamakBinding.unavailable }
574
- return b.run { let value = try b.target(CLLocationSourceInformation.self).isSimulatedBySoftware; return b.encode(value) }
575
- #if os(iOS)
576
- case "CLLocationPushServiceErrorDomain":
577
- guard #available(iOS 15.0, *) else { throw TokamakBinding.unavailable }
578
- return b.run { let value = CLLocationPushServiceErrorDomain; return b.encode(value) }
579
- #endif
580
- case "CL_TARGET_SUPPORTS_CONDITIONS":
581
- return b.run { let value = CL_TARGET_SUPPORTS_CONDITIONS; return b.encode(value) }
582
- case "kCLErrorDomain":
583
- return b.run { let value = kCLErrorDomain; return b.encode(value) }
584
- case "kCLErrorUserInfoAlternateRegionKey":
585
- guard #available(iOS 5.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
586
- return b.run { let value = kCLErrorUserInfoAlternateRegionKey; return b.encode(value) }
587
- case "kCLHeadingFilterNone":
588
- return b.run { let value = kCLHeadingFilterNone; return b.encode(value) }
589
- case "CLLocationCoordinate2DIsValid(_:)":
590
- guard #available(iOS 4.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
591
- return b.run { let value = try CLLocationCoordinate2DIsValid(TokamakBindings_location.decode(b[0], b, as: CLLocationCoordinate2D.self)); return b.encode(value) }
592
- case "CLLocationCoordinate2DMake(_:_:)":
593
- guard #available(iOS 4.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
594
- return b.run { let value = try CLLocationCoordinate2DMake(b.decode(b[0], as: CLLocationDegrees.self), b.decode(b[1], as: CLLocationDegrees.self)); return TokamakBindings_location.encode(value, b) }
595
- case "CLLocationDistanceMax":
596
- guard #available(iOS 6.0, macOS 10.14, *) else { throw TokamakBinding.unavailable }
597
- return b.run { let value = CLLocationDistanceMax; return b.encode(value) }
598
- case "CLTimeIntervalMax":
599
- guard #available(iOS 6.0, macOS 10.14, *) else { throw TokamakBinding.unavailable }
600
- return b.run { let value = CLTimeIntervalMax; return b.encode(value) }
601
- case "kCLDistanceFilterNone":
602
- return b.run { let value = kCLDistanceFilterNone; return b.encode(value) }
603
- case "kCLLocationAccuracyBest":
604
- return b.run { let value = kCLLocationAccuracyBest; return b.encode(value) }
605
- case "kCLLocationAccuracyBestForNavigation":
606
- guard #available(iOS 4.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
607
- return b.run { let value = kCLLocationAccuracyBestForNavigation; return b.encode(value) }
608
- case "kCLLocationAccuracyHundredMeters":
609
- return b.run { let value = kCLLocationAccuracyHundredMeters; return b.encode(value) }
610
- case "kCLLocationAccuracyKilometer":
611
- return b.run { let value = kCLLocationAccuracyKilometer; return b.encode(value) }
612
- case "kCLLocationAccuracyNearestTenMeters":
613
- return b.run { let value = kCLLocationAccuracyNearestTenMeters; return b.encode(value) }
614
- case "kCLLocationAccuracyReduced":
615
- guard #available(iOS 14.0, macOS 11.0, *) else { throw TokamakBinding.unavailable }
616
- return b.run { let value = kCLLocationAccuracyReduced; return b.encode(value) }
617
- case "kCLLocationAccuracyThreeKilometers":
618
- return b.run { let value = kCLLocationAccuracyThreeKilometers; return b.encode(value) }
619
- case "kCLLocationCoordinate2DInvalid":
620
- guard #available(iOS 4.0, macOS 10.7, *) else { throw TokamakBinding.unavailable }
621
- return b.run { let value = kCLLocationCoordinate2DInvalid; return TokamakBindings_location.encode(value, b) }
622
- default:
623
- throw .notSupported("\(method) is not supported")
624
- }
625
- }
626
-
627
- func subscribeBytes(method: String, payload: Data, reply: @escaping TokamakPluginBytesReply)
628
- throws(TokamakPluginError) -> () -> Void
629
- {
630
- let b = try TokamakBinding(payload, resources: host.resources, reply: reply)
631
- switch method {
632
- case "CLLocationManagerDelegate":
633
- return b.implement(CLLocationManagerDelegateImplementation.self)
634
- #if os(iOS)
635
- case "CLBackgroundActivitySession.diagnostics":
636
- guard #available(iOS 18.0, *) else { throw TokamakBinding.unavailable }
637
- return b.stream({ try b.target(CLBackgroundActivitySession.self).diagnostics }, encode: { TokamakBindings_location.encode($0, b) })
638
- #endif
639
- case "CLLocationUpdate.liveUpdates(_:)":
640
- guard #available(iOS 17.0, macOS 14.0, *) else { throw TokamakBinding.unavailable }
641
- return b.stream({ try CLLocationUpdate.liveUpdates(TokamakBindings_location.decode(b[0], b, as: CLLocationUpdate.LiveConfiguration.self)) }, encode: { TokamakBindings_location.encode($0, b) })
642
- #if os(iOS)
643
- case "CLServiceSession.diagnostics":
644
- guard #available(iOS 18.0, *) else { throw TokamakBinding.unavailable }
645
- return b.stream({ try b.target(CLServiceSession.self).diagnostics }, encode: { TokamakBindings_location.encode($0, b) })
646
- #endif
647
- default:
648
- throw .notSupported("\(method) is not supported")
649
- }
650
- }
651
-
652
- private static func encode(_ value: CLAccuracyAuthorization, _ b: TokamakBinding) -> Any {
653
- if value == .fullAccuracy { return "fullAccuracy" }
654
- if value == .reducedAccuracy { return "reducedAccuracy" }
655
- return "\(value)"
656
- }
657
-
658
- private static func decode(_ value: Any, _ b: TokamakBinding, as type: CLAccuracyAuthorization.Type) throws -> CLAccuracyAuthorization {
659
- switch try b.decode(value, as: String.self) {
660
- case "fullAccuracy":
661
- return .fullAccuracy
662
- case "reducedAccuracy":
663
- return .reducedAccuracy
664
- default: throw b.mismatch(value, type)
665
- }
666
- }
667
-
668
- private static func encode(_ value: CLActivityType, _ b: TokamakBinding) -> Any {
669
- if #available(iOS 12.0, macOS 10.14, *), value == .airborne { return "airborne" }
670
- if value == .automotiveNavigation { return "automotiveNavigation" }
671
- if value == .fitness { return "fitness" }
672
- if value == .other { return "other" }
673
- if value == .otherNavigation { return "otherNavigation" }
674
- return "\(value)"
675
- }
676
-
677
- private static func decode(_ value: Any, _ b: TokamakBinding, as type: CLActivityType.Type) throws -> CLActivityType {
678
- switch try b.decode(value, as: String.self) {
679
- case "airborne":
680
- guard #available(iOS 12.0, macOS 10.14, *) else { throw TokamakBinding.unavailable }
681
- return .airborne
682
- case "automotiveNavigation":
683
- return .automotiveNavigation
684
- case "fitness":
685
- return .fitness
686
- case "other":
687
- return .other
688
- case "otherNavigation":
689
- return .otherNavigation
690
- default: throw b.mismatch(value, type)
691
- }
692
- }
693
-
694
- private static func encode(_ value: CLAuthorizationStatus, _ b: TokamakBinding) -> Any {
695
- if #available(iOS 8.0, macOS 10.12, *), value == .authorizedAlways { return "authorizedAlways" }
696
- #if os(iOS)
697
- if #available(iOS 8.0, *), value == .authorizedWhenInUse { return "authorizedWhenInUse" }
698
- #endif
699
- if value == .denied { return "denied" }
700
- if value == .notDetermined { return "notDetermined" }
701
- if value == .restricted { return "restricted" }
702
- return "\(value)"
703
- }
704
-
705
- private static func decode(_ value: Any, _ b: TokamakBinding, as type: CLAuthorizationStatus.Type) throws -> CLAuthorizationStatus {
706
- switch try b.decode(value, as: String.self) {
707
- case "authorizedAlways":
708
- guard #available(iOS 8.0, macOS 10.12, *) else { throw TokamakBinding.unavailable }
709
- return .authorizedAlways
710
- #if os(iOS)
711
- case "authorizedWhenInUse":
712
- guard #available(iOS 8.0, *) else { throw TokamakBinding.unavailable }
713
- return .authorizedWhenInUse
714
- #endif
715
- case "denied":
716
- return .denied
717
- case "notDetermined":
718
- return .notDetermined
719
- case "restricted":
720
- return .restricted
721
- default: throw b.mismatch(value, type)
722
- }
723
- }
724
- #if os(iOS)
725
-
726
- @available(iOS 18.0, *)
727
- private static func encode(_ value: CLBackgroundActivitySession.Diagnostic, _ b: TokamakBinding) -> Any {
728
- var fields: [String: Any] = [:]
729
- fields["authorizationDenied"] = b.encode(value.authorizationDenied)
730
- fields["authorizationDeniedGlobally"] = b.encode(value.authorizationDeniedGlobally)
731
- fields["authorizationRequestInProgress"] = b.encode(value.authorizationRequestInProgress)
732
- fields["authorizationRestricted"] = b.encode(value.authorizationRestricted)
733
- fields["insufficientlyInUse"] = b.encode(value.insufficientlyInUse)
734
- fields["serviceSessionRequired"] = b.encode(value.serviceSessionRequired)
735
- return fields
736
- }
737
- #endif
738
-
739
- private static func encode(_ value: CLDeviceOrientation, _ b: TokamakBinding) -> Any {
740
- if value == .faceDown { return "faceDown" }
741
- if value == .faceUp { return "faceUp" }
742
- if value == .landscapeLeft { return "landscapeLeft" }
743
- if value == .landscapeRight { return "landscapeRight" }
744
- if value == .portrait { return "portrait" }
745
- if value == .portraitUpsideDown { return "portraitUpsideDown" }
746
- if value == .unknown { return "unknown" }
747
- return "\(value)"
748
- }
749
-
750
- private static func decode(_ value: Any, _ b: TokamakBinding, as type: CLDeviceOrientation.Type) throws -> CLDeviceOrientation {
751
- switch try b.decode(value, as: String.self) {
752
- case "faceDown":
753
- return .faceDown
754
- case "faceUp":
755
- return .faceUp
756
- case "landscapeLeft":
757
- return .landscapeLeft
758
- case "landscapeRight":
759
- return .landscapeRight
760
- case "portrait":
761
- return .portrait
762
- case "portraitUpsideDown":
763
- return .portraitUpsideDown
764
- case "unknown":
765
- return .unknown
766
- default: throw b.mismatch(value, type)
767
- }
768
- }
769
-
770
- private final class CLLocationManagerDelegateImplementation: TokamakBindingImplementation, CLLocationManagerDelegate {
771
- override class var selectors: [Selector: String] {
772
- [
773
- NSSelectorFromString("locationManager:didChangeAuthorizationStatus:"): "locationManagerDidChangeAuthorizationStatus",
774
- NSSelectorFromString("locationManager:didDetermineState:forRegion:"): "locationManagerDidDetermineStateForRegion",
775
- NSSelectorFromString("locationManager:didEnterRegion:"): "locationManagerDidEnterRegion",
776
- NSSelectorFromString("locationManager:didExitRegion:"): "locationManagerDidExitRegion",
777
- NSSelectorFromString("locationManager:didFailRangingBeaconsForConstraint:error:"): "locationManagerDidFailRangingBeaconsForConstraintError",
778
- NSSelectorFromString("locationManager:didFailWithError:"): "locationManagerDidFailWithError",
779
- NSSelectorFromString("locationManager:didFinishDeferredUpdatesWithError:"): "locationManagerDidFinishDeferredUpdatesWithError",
780
- NSSelectorFromString("locationManager:didRangeBeacons:satisfyingConstraint:"): "locationManagerDidRangeBeaconsSatisfyingConstraint",
781
- NSSelectorFromString("locationManager:didRangeBeacons:inRegion:"): "locationManagerDidRangeBeaconsInRegion",
782
- NSSelectorFromString("locationManager:didStartMonitoringForRegion:"): "locationManagerDidStartMonitoringForRegion",
783
- NSSelectorFromString("locationManager:didUpdateHeading:"): "locationManagerDidUpdateHeading",
784
- NSSelectorFromString("locationManager:didUpdateLocations:"): "locationManagerDidUpdateLocations",
785
- NSSelectorFromString("locationManager:didVisit:"): "locationManagerDidVisit",
786
- NSSelectorFromString("locationManager:monitoringDidFailForRegion:withError:"): "locationManagerMonitoringDidFailForRegionWithError",
787
- NSSelectorFromString("locationManager:rangingBeaconsDidFailForRegion:withError:"): "locationManagerRangingBeaconsDidFailForRegionWithError",
788
- NSSelectorFromString("locationManagerDidChangeAuthorization:"): "locationManagerDidChangeAuthorization",
789
- NSSelectorFromString("locationManagerDidPauseLocationUpdates:"): "locationManagerDidPauseLocationUpdates",
790
- NSSelectorFromString("locationManagerDidResumeLocationUpdates:"): "locationManagerDidResumeLocationUpdates",
791
- NSSelectorFromString("locationManager:didUpdateToLocation:fromLocation:"): "locationManagerDidUpdateToLocationFromLocation",
792
- ]
793
- }
794
-
795
- @available(iOS 4.2, macOS 10.7, *)
796
- func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
797
- call("locationManagerDidChangeAuthorizationStatus") { b in [b.encode(object: manager), TokamakBindings_location.encode(status, b)] }
798
- }
799
-
800
- @available(iOS 7.0, macOS 10.10, *)
801
- func locationManager(_ manager: CLLocationManager, didDetermineState state: CLRegionState, for region: CLRegion) {
802
- call("locationManagerDidDetermineStateForRegion") { b in [b.encode(object: manager), TokamakBindings_location.encode(state, b), b.encode(object: region)] }
803
- }
804
-
805
- @available(iOS 4.0, macOS 10.8, *)
806
- func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {
807
- call("locationManagerDidEnterRegion") { b in [b.encode(object: manager), b.encode(object: region)] }
808
- }
809
-
810
- @available(iOS 4.0, macOS 10.8, *)
811
- func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) {
812
- call("locationManagerDidExitRegion") { b in [b.encode(object: manager), b.encode(object: region)] }
813
- }
814
-
815
- @available(iOS 13.0, macOS 10.15, *)
816
- func locationManager(_ manager: CLLocationManager, didFailRangingFor beaconConstraint: CLBeaconIdentityConstraint, error: any Error) {
817
- call("locationManagerDidFailRangingBeaconsForConstraintError") { b in [b.encode(object: manager), b.encode(object: beaconConstraint), b.encode(error)] }
818
- }
819
-
820
- @available(iOS 2.0, macOS 10.6, *)
821
- func locationManager(_ manager: CLLocationManager, didFailWithError error: any Error) {
822
- call("locationManagerDidFailWithError") { b in [b.encode(object: manager), b.encode(error)] }
823
- }
824
-
825
- @available(iOS 6.0, macOS 10.9, *)
826
- func locationManager(_ manager: CLLocationManager, didFinishDeferredUpdatesWithError error: (any Error)?) {
827
- call("locationManagerDidFinishDeferredUpdatesWithError") { b in [b.encode(object: manager), b.encode(optional: error) { b.encode($0) }] }
828
- }
829
-
830
- @available(iOS 13.0, macOS 10.15, *)
831
- func locationManager(_ manager: CLLocationManager, didRange beacons: [CLBeacon], satisfying beaconConstraint: CLBeaconIdentityConstraint) {
832
- call("locationManagerDidRangeBeaconsSatisfyingConstraint") { b in [b.encode(object: manager), b.encode(array: beacons) { b.encode(object: $0) }, b.encode(object: beaconConstraint)] }
833
- }
834
-
835
- @available(iOS 7.0, macOS 10.15, *)
836
- func locationManager(_ manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion) {
837
- call("locationManagerDidRangeBeaconsInRegion") { b in [b.encode(object: manager), b.encode(array: beacons) { b.encode(object: $0) }, b.encode(object: region)] }
838
- }
839
-
840
- @available(iOS 5.0, macOS 10.8, *)
841
- func locationManager(_ manager: CLLocationManager, didStartMonitoringFor region: CLRegion) {
842
- call("locationManagerDidStartMonitoringForRegion") { b in [b.encode(object: manager), b.encode(object: region)] }
843
- }
844
-
845
- @available(iOS 3.0, macOS 10.15, *)
846
- func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading) {
847
- call("locationManagerDidUpdateHeading") { b in [b.encode(object: manager), b.encode(object: newHeading)] }
848
- }
849
-
850
- @available(iOS 6.0, macOS 10.9, *)
851
- func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
852
- call("locationManagerDidUpdateLocations") { b in [b.encode(object: manager), b.encode(array: locations) { b.encode(object: $0) }] }
853
- }
854
-
855
- @available(iOS 8.0, macOS 10.15, *)
856
- func locationManager(_ manager: CLLocationManager, didVisit visit: CLVisit) {
857
- call("locationManagerDidVisit") { b in [b.encode(object: manager), b.encode(object: visit)] }
858
- }
859
-
860
- @available(iOS 4.0, macOS 10.8, *)
861
- func locationManager(_ manager: CLLocationManager, monitoringDidFailFor region: CLRegion?, withError error: any Error) {
862
- call("locationManagerMonitoringDidFailForRegionWithError") { b in [b.encode(object: manager), b.encode(optional: region) { b.encode(object: $0) }, b.encode(error)] }
863
- }
864
-
865
- @available(iOS 7.0, macOS 10.15, *)
866
- func locationManager(_ manager: CLLocationManager, rangingBeaconsDidFailFor region: CLBeaconRegion, withError error: any Error) {
867
- call("locationManagerRangingBeaconsDidFailForRegionWithError") { b in [b.encode(object: manager), b.encode(object: region), b.encode(error)] }
868
- }
869
-
870
- @available(iOS 14.0, macOS 11.0, *)
871
- func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
872
- call("locationManagerDidChangeAuthorization") { b in [b.encode(object: manager)] }
873
- }
874
-
875
- @available(iOS 6.0, macOS 10.15, *)
876
- func locationManagerDidPauseLocationUpdates(_ manager: CLLocationManager) {
877
- call("locationManagerDidPauseLocationUpdates") { b in [b.encode(object: manager)] }
878
- }
879
-
880
- @available(iOS 6.0, macOS 10.15, *)
881
- func locationManagerDidResumeLocationUpdates(_ manager: CLLocationManager) {
882
- call("locationManagerDidResumeLocationUpdates") { b in [b.encode(object: manager)] }
883
- }
884
- #if os(macOS)
885
-
886
- @available(macOS 10.6, *)
887
- func locationManager(_ manager: CLLocationManager, didUpdateTo newLocation: CLLocation, from oldLocation: CLLocation) {
888
- call("locationManagerDidUpdateToLocationFromLocation") { b in [b.encode(object: manager), b.encode(object: newLocation), b.encode(object: oldLocation)] }
889
- }
890
- #endif
891
- }
892
-
893
- @available(iOS 17.0, macOS 14.0, *)
894
- private static func encode(_ value: CLLocationUpdate, _ b: TokamakBinding) -> Any {
895
- var fields: [String: Any] = [:]
896
- if #available(iOS 18.0, macOS 15.0, *) { fields["accuracyLimited"] = b.encode(value.accuracyLimited) }
897
- if #available(iOS 18.0, macOS 15.0, *) { fields["authorizationDenied"] = b.encode(value.authorizationDenied) }
898
- if #available(iOS 18.0, macOS 15.0, *) { fields["authorizationDeniedGlobally"] = b.encode(value.authorizationDeniedGlobally) }
899
- if #available(iOS 18.0, macOS 15.0, *) { fields["authorizationRequestInProgress"] = b.encode(value.authorizationRequestInProgress) }
900
- if #available(iOS 18.0, macOS 15.0, *) { fields["authorizationRestricted"] = b.encode(value.authorizationRestricted) }
901
- if #available(iOS 18.0, macOS 15.0, *) { fields["insufficientlyInUse"] = b.encode(value.insufficientlyInUse) }
902
- fields["isStationary"] = b.encode(value.isStationary)
903
- fields["location"] = b.encode(optional: value.location) { b.encode(object: $0) }
904
- if #available(iOS 18.0, macOS 15.0, *) { fields["locationUnavailable"] = b.encode(value.locationUnavailable) }
905
- if #available(iOS 18.0, macOS 15.0, *) { fields["serviceSessionRequired"] = b.encode(value.serviceSessionRequired) }
906
- if #available(iOS 18.0, macOS 15.0, *) { fields["stationary"] = b.encode(value.stationary) }
907
- return fields
908
- }
909
-
910
- @available(iOS 17.0, macOS 14.0, *)
911
- private static func encode(_ value: CLLocationUpdate.LiveConfiguration, _ b: TokamakBinding) -> Any {
912
- if value == .airborne { return "airborne" }
913
- if value == .automotiveNavigation { return "automotiveNavigation" }
914
- if value == .default { return "default" }
915
- if value == .fitness { return "fitness" }
916
- if value == .otherNavigation { return "otherNavigation" }
917
- return "\(value)"
918
- }
919
-
920
- @available(iOS 17.0, macOS 14.0, *)
921
- private static func decode(_ value: Any, _ b: TokamakBinding, as type: CLLocationUpdate.LiveConfiguration.Type) throws -> CLLocationUpdate.LiveConfiguration {
922
- switch try b.decode(value, as: String.self) {
923
- case "airborne":
924
- return .airborne
925
- case "automotiveNavigation":
926
- return .automotiveNavigation
927
- case "default":
928
- return .default
929
- case "fitness":
930
- return .fitness
931
- case "otherNavigation":
932
- return .otherNavigation
933
- default: throw b.mismatch(value, type)
934
- }
935
- }
936
-
937
- @available(iOS 17.0, macOS 14.0, *)
938
- private static func encode(_ value: CLMonitor.BeaconIdentityCondition, _ b: TokamakBinding) -> Any {
939
- var fields: [String: Any] = [:]
940
- fields["major"] = b.encode(optional: value.major) { b.encode($0) }
941
- fields["minor"] = b.encode(optional: value.minor) { b.encode($0) }
942
- fields["uuid"] = b.encode(value.uuid)
943
- return fields
944
- }
945
-
946
- @available(iOS 17.0, macOS 14.0, *)
947
- private static func encode(_ value: CLMonitor.CircularGeographicCondition, _ b: TokamakBinding) -> Any {
948
- var fields: [String: Any] = [:]
949
- fields["center"] = TokamakBindings_location.encode(value.center, b)
950
- fields["radius"] = b.encode(value.radius)
951
- return fields
952
- }
953
-
954
- @available(iOS 17.0, macOS 14.0, *)
955
- private static func decode(_ value: Any, _ b: TokamakBinding, as type: CLMonitor.CircularGeographicCondition.Type) throws -> CLMonitor.CircularGeographicCondition {
956
- try CLMonitor.CircularGeographicCondition(
957
- center: TokamakBindings_location.decode(b.field(value, "center"), b, as: CLLocationCoordinate2D.self),
958
- radius: b.decode(b.field(value, "radius"), as: CLLocationDistance.self)
959
- )
960
- }
961
-
962
- @available(iOS 7.0, macOS 10.15, *)
963
- private static func encode(_ value: CLProximity, _ b: TokamakBinding) -> Any {
964
- if value == .far { return "far" }
965
- if value == .immediate { return "immediate" }
966
- if value == .near { return "near" }
967
- if value == .unknown { return "unknown" }
968
- return "\(value)"
969
- }
970
-
971
- @available(iOS 7.0, macOS 10.15, *)
972
- private static func decode(_ value: Any, _ b: TokamakBinding, as type: CLProximity.Type) throws -> CLProximity {
973
- switch try b.decode(value, as: String.self) {
974
- case "far":
975
- return .far
976
- case "immediate":
977
- return .immediate
978
- case "near":
979
- return .near
980
- case "unknown":
981
- return .unknown
982
- default: throw b.mismatch(value, type)
983
- }
984
- }
985
-
986
- @available(iOS 7.0, macOS 10.10, *)
987
- private static func encode(_ value: CLRegionState, _ b: TokamakBinding) -> Any {
988
- if value == .inside { return "inside" }
989
- if value == .outside { return "outside" }
990
- if value == .unknown { return "unknown" }
991
- return "\(value)"
992
- }
993
-
994
- @available(iOS 7.0, macOS 10.10, *)
995
- private static func decode(_ value: Any, _ b: TokamakBinding, as type: CLRegionState.Type) throws -> CLRegionState {
996
- switch try b.decode(value, as: String.self) {
997
- case "inside":
998
- return .inside
999
- case "outside":
1000
- return .outside
1001
- case "unknown":
1002
- return .unknown
1003
- default: throw b.mismatch(value, type)
1004
- }
1005
- }
1006
- #if os(iOS)
1007
-
1008
- @available(iOS 18.0, *)
1009
- private static func encode(_ value: CLServiceSession.AuthorizationRequirement, _ b: TokamakBinding) -> Any {
1010
- if value == .always { return "always" }
1011
- if value == .none { return "none" }
1012
- if value == .whenInUse { return "whenInUse" }
1013
- return "\(value)"
1014
- }
1015
-
1016
- @available(iOS 18.0, *)
1017
- private static func decode(_ value: Any, _ b: TokamakBinding, as type: CLServiceSession.AuthorizationRequirement.Type) throws -> CLServiceSession.AuthorizationRequirement {
1018
- switch try b.decode(value, as: String.self) {
1019
- case "always":
1020
- return .always
1021
- case "none":
1022
- return .none
1023
- case "whenInUse":
1024
- return .whenInUse
1025
- default: throw b.mismatch(value, type)
1026
- }
1027
- }
1028
- #endif
1029
- #if os(iOS)
1030
-
1031
- @available(iOS 18.0, *)
1032
- private static func encode(_ value: CLServiceSession.Diagnostic, _ b: TokamakBinding) -> Any {
1033
- var fields: [String: Any] = [:]
1034
- fields["alwaysAuthorizationDenied"] = b.encode(value.alwaysAuthorizationDenied)
1035
- fields["authorizationDenied"] = b.encode(value.authorizationDenied)
1036
- fields["authorizationDeniedGlobally"] = b.encode(value.authorizationDeniedGlobally)
1037
- fields["authorizationRequestInProgress"] = b.encode(value.authorizationRequestInProgress)
1038
- fields["authorizationRestricted"] = b.encode(value.authorizationRestricted)
1039
- fields["fullAccuracyDenied"] = b.encode(value.fullAccuracyDenied)
1040
- fields["insufficientlyInUse"] = b.encode(value.insufficientlyInUse)
1041
- fields["serviceSessionRequired"] = b.encode(value.serviceSessionRequired)
1042
- return fields
1043
- }
1044
- #endif
1045
-
1046
- private static func encode(_ value: CLLocationCoordinate2D, _ b: TokamakBinding) -> Any {
1047
- var fields: [String: Any] = [:]
1048
- fields["latitude"] = b.encode(value.latitude)
1049
- fields["longitude"] = b.encode(value.longitude)
1050
- return fields
1051
- }
1052
-
1053
- private static func decode(_ value: Any, _ b: TokamakBinding, as type: CLLocationCoordinate2D.Type) throws -> CLLocationCoordinate2D {
1054
- try CLLocationCoordinate2D(
1055
- latitude: b.decode(b.field(value, "latitude"), as: CLLocationDegrees.self),
1056
- longitude: b.decode(b.field(value, "longitude"), as: CLLocationDegrees.self)
1057
- )
1058
- }
1059
- }