icrate 0.1.2

Bindings to Apple's frameworks
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::CoreLocation::*;
use crate::Foundation::*;
use crate::HealthKit::*;
use crate::UniformTypeIdentifiers::*;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "HealthKit_HKQuery")]
    pub struct HKQuery;

    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl ClassType for HKQuery {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "HealthKit_HKQuery")]
unsafe impl NSObjectProtocol for HKQuery {}

extern_methods!(
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(feature = "HealthKit_HKObjectType")]
        #[method_id(@__retain_semantics Other objectType)]
        pub unsafe fn objectType(&self) -> Option<Id<HKObjectType>>;

        #[cfg(feature = "HealthKit_HKSampleType")]
        #[deprecated]
        #[method_id(@__retain_semantics Other sampleType)]
        pub unsafe fn sampleType(&self) -> Option<Id<HKSampleType>>;

        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicate)]
        pub unsafe fn predicate(&self) -> Option<Id<NSPredicate>>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

ns_options!(
    #[underlying(NSUInteger)]
    pub enum HKQueryOptions {
        HKQueryOptionNone = 0,
        HKQueryOptionStrictStartDate = 1 << 0,
        HKQueryOptionStrictEndDate = 1 << 1,
    }
);

extern_methods!(
    /// HKObjectPredicates
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(all(feature = "Foundation_NSPredicate", feature = "Foundation_NSString"))]
        #[method_id(@__retain_semantics Other predicateForObjectsWithMetadataKey:)]
        pub unsafe fn predicateForObjectsWithMetadataKey(key: &NSString) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSPredicate",
            feature = "Foundation_NSString"
        ))]
        #[method_id(@__retain_semantics Other predicateForObjectsWithMetadataKey:allowedValues:)]
        pub unsafe fn predicateForObjectsWithMetadataKey_allowedValues(
            key: &NSString,
            allowed_values: &NSArray,
        ) -> Id<NSPredicate>;

        #[cfg(all(feature = "Foundation_NSPredicate", feature = "Foundation_NSString"))]
        #[method_id(@__retain_semantics Other predicateForObjectsWithMetadataKey:operatorType:value:)]
        pub unsafe fn predicateForObjectsWithMetadataKey_operatorType_value(
            key: &NSString,
            operator_type: NSPredicateOperatorType,
            value: &AnyObject,
        ) -> Id<NSPredicate>;

        #[cfg(all(feature = "Foundation_NSPredicate", feature = "HealthKit_HKSource"))]
        #[method_id(@__retain_semantics Other predicateForObjectsFromSource:)]
        pub unsafe fn predicateForObjectsFromSource(source: &HKSource) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "Foundation_NSSet",
            feature = "HealthKit_HKSource"
        ))]
        #[method_id(@__retain_semantics Other predicateForObjectsFromSources:)]
        pub unsafe fn predicateForObjectsFromSources(sources: &NSSet<HKSource>) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "Foundation_NSSet",
            feature = "HealthKit_HKSourceRevision"
        ))]
        #[method_id(@__retain_semantics Other predicateForObjectsFromSourceRevisions:)]
        pub unsafe fn predicateForObjectsFromSourceRevisions(
            source_revisions: &NSSet<HKSourceRevision>,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "Foundation_NSSet",
            feature = "HealthKit_HKDevice"
        ))]
        #[method_id(@__retain_semantics Other predicateForObjectsFromDevices:)]
        pub unsafe fn predicateForObjectsFromDevices(devices: &NSSet<HKDevice>) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "Foundation_NSSet",
            feature = "Foundation_NSString"
        ))]
        #[method_id(@__retain_semantics Other predicateForObjectsWithDeviceProperty:allowedValues:)]
        pub unsafe fn predicateForObjectsWithDeviceProperty_allowedValues(
            key: &NSString,
            allowed_values: &NSSet<NSString>,
        ) -> Id<NSPredicate>;

        #[cfg(all(feature = "Foundation_NSPredicate", feature = "Foundation_NSUUID"))]
        #[method_id(@__retain_semantics Other predicateForObjectWithUUID:)]
        pub unsafe fn predicateForObjectWithUUID(uuid: &NSUUID) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "Foundation_NSSet",
            feature = "Foundation_NSUUID"
        ))]
        #[method_id(@__retain_semantics Other predicateForObjectsWithUUIDs:)]
        pub unsafe fn predicateForObjectsWithUUIDs(uui_ds: &NSSet<NSUUID>) -> Id<NSPredicate>;

        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicateForObjectsWithNoCorrelation)]
        pub unsafe fn predicateForObjectsWithNoCorrelation() -> Id<NSPredicate>;

        #[cfg(all(feature = "Foundation_NSPredicate", feature = "HealthKit_HKWorkout"))]
        #[method_id(@__retain_semantics Other predicateForObjectsFromWorkout:)]
        pub unsafe fn predicateForObjectsFromWorkout(workout: &HKWorkout) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "HealthKit_HKElectrocardiogram"
        ))]
        #[method_id(@__retain_semantics Other predicateForObjectsAssociatedWithElectrocardiogram:)]
        pub unsafe fn predicateForObjectsAssociatedWithElectrocardiogram(
            electrocardiogram: &HKElectrocardiogram,
        ) -> Id<NSPredicate>;
    }
);

extern_methods!(
    /// HKSamplePredicates
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(all(feature = "Foundation_NSDate", feature = "Foundation_NSPredicate"))]
        #[method_id(@__retain_semantics Other predicateForSamplesWithStartDate:endDate:options:)]
        pub unsafe fn predicateForSamplesWithStartDate_endDate_options(
            start_date: Option<&NSDate>,
            end_date: Option<&NSDate>,
            options: HKQueryOptions,
        ) -> Id<NSPredicate>;
    }
);

extern_methods!(
    /// HKQuantitySamplePredicates
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(all(feature = "Foundation_NSPredicate", feature = "HealthKit_HKQuantity"))]
        #[method_id(@__retain_semantics Other predicateForQuantitySamplesWithOperatorType:quantity:)]
        pub unsafe fn predicateForQuantitySamplesWithOperatorType_quantity(
            operator_type: NSPredicateOperatorType,
            quantity: &HKQuantity,
        ) -> Id<NSPredicate>;
    }
);

extern_methods!(
    /// HKCategorySamplePredicates
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicateForCategorySamplesWithOperatorType:value:)]
        pub unsafe fn predicateForCategorySamplesWithOperatorType_value(
            operator_type: NSPredicateOperatorType,
            value: NSInteger,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSNumber",
            feature = "Foundation_NSPredicate",
            feature = "Foundation_NSSet"
        ))]
        #[method_id(@__retain_semantics Other predicateForCategorySamplesEqualToValues:)]
        pub unsafe fn predicateForCategorySamplesEqualToValues(
            values: &NSSet<NSNumber>,
        ) -> Id<NSPredicate>;
    }
);

extern_methods!(
    /// HKWorkoutPredicates
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithWorkoutActivityType:)]
        pub unsafe fn predicateForWorkoutsWithWorkoutActivityType(
            workout_activity_type: HKWorkoutActivityType,
        ) -> Id<NSPredicate>;

        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithOperatorType:duration:)]
        pub unsafe fn predicateForWorkoutsWithOperatorType_duration(
            operator_type: NSPredicateOperatorType,
            duration: NSTimeInterval,
        ) -> Id<NSPredicate>;

        #[cfg(all(feature = "Foundation_NSPredicate", feature = "HealthKit_HKQuantity"))]
        #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierActiveEnergyBurned"]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithOperatorType:totalEnergyBurned:)]
        pub unsafe fn predicateForWorkoutsWithOperatorType_totalEnergyBurned(
            operator_type: NSPredicateOperatorType,
            total_energy_burned: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(all(feature = "Foundation_NSPredicate", feature = "HealthKit_HKQuantity"))]
        #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for the desired distance type"]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithOperatorType:totalDistance:)]
        pub unsafe fn predicateForWorkoutsWithOperatorType_totalDistance(
            operator_type: NSPredicateOperatorType,
            total_distance: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(all(feature = "Foundation_NSPredicate", feature = "HealthKit_HKQuantity"))]
        #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity:"]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithOperatorType:totalSwimmingStrokeCount:)]
        pub unsafe fn predicateForWorkoutsWithOperatorType_totalSwimmingStrokeCount(
            operator_type: NSPredicateOperatorType,
            total_swimming_stroke_count: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(all(feature = "Foundation_NSPredicate", feature = "HealthKit_HKQuantity"))]
        #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierSwimmingStrokeCount"]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithOperatorType:totalFlightsClimbed:)]
        pub unsafe fn predicateForWorkoutsWithOperatorType_totalFlightsClimbed(
            operator_type: NSPredicateOperatorType,
            total_flights_climbed: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "HealthKit_HKQuantity",
            feature = "HealthKit_HKQuantityType"
        ))]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithOperatorType:quantityType:sumQuantity:)]
        pub unsafe fn predicateForWorkoutsWithOperatorType_quantityType_sumQuantity(
            operator_type: NSPredicateOperatorType,
            quantity_type: &HKQuantityType,
            sum_quantity: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "HealthKit_HKQuantity",
            feature = "HealthKit_HKQuantityType"
        ))]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithOperatorType:quantityType:minimumQuantity:)]
        pub unsafe fn predicateForWorkoutsWithOperatorType_quantityType_minimumQuantity(
            operator_type: NSPredicateOperatorType,
            quantity_type: &HKQuantityType,
            minimum_quantity: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "HealthKit_HKQuantity",
            feature = "HealthKit_HKQuantityType"
        ))]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithOperatorType:quantityType:maximumQuantity:)]
        pub unsafe fn predicateForWorkoutsWithOperatorType_quantityType_maximumQuantity(
            operator_type: NSPredicateOperatorType,
            quantity_type: &HKQuantityType,
            maximum_quantity: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "HealthKit_HKQuantity",
            feature = "HealthKit_HKQuantityType"
        ))]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithOperatorType:quantityType:averageQuantity:)]
        pub unsafe fn predicateForWorkoutsWithOperatorType_quantityType_averageQuantity(
            operator_type: NSPredicateOperatorType,
            quantity_type: &HKQuantityType,
            average_quantity: &HKQuantity,
        ) -> Id<NSPredicate>;
    }
);

extern_methods!(
    /// HKWorkoutActivityPredicates
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicateForWorkoutActivitiesWithWorkoutActivityType:)]
        pub unsafe fn predicateForWorkoutActivitiesWithWorkoutActivityType(
            workout_activity_type: HKWorkoutActivityType,
        ) -> Id<NSPredicate>;

        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicateForWorkoutActivitiesWithOperatorType:duration:)]
        pub unsafe fn predicateForWorkoutActivitiesWithOperatorType_duration(
            operator_type: NSPredicateOperatorType,
            duration: NSTimeInterval,
        ) -> Id<NSPredicate>;

        #[cfg(all(feature = "Foundation_NSDate", feature = "Foundation_NSPredicate"))]
        #[method_id(@__retain_semantics Other predicateForWorkoutActivitiesWithStartDate:endDate:options:)]
        pub unsafe fn predicateForWorkoutActivitiesWithStartDate_endDate_options(
            start_date: Option<&NSDate>,
            end_date: Option<&NSDate>,
            options: HKQueryOptions,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "HealthKit_HKQuantity",
            feature = "HealthKit_HKQuantityType"
        ))]
        #[method_id(@__retain_semantics Other predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity:)]
        pub unsafe fn predicateForWorkoutActivitiesWithOperatorType_quantityType_sumQuantity(
            operator_type: NSPredicateOperatorType,
            quantity_type: &HKQuantityType,
            sum_quantity: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "HealthKit_HKQuantity",
            feature = "HealthKit_HKQuantityType"
        ))]
        #[method_id(@__retain_semantics Other predicateForWorkoutActivitiesWithOperatorType:quantityType:minimumQuantity:)]
        pub unsafe fn predicateForWorkoutActivitiesWithOperatorType_quantityType_minimumQuantity(
            operator_type: NSPredicateOperatorType,
            quantity_type: &HKQuantityType,
            minimum_quantity: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "HealthKit_HKQuantity",
            feature = "HealthKit_HKQuantityType"
        ))]
        #[method_id(@__retain_semantics Other predicateForWorkoutActivitiesWithOperatorType:quantityType:maximumQuantity:)]
        pub unsafe fn predicateForWorkoutActivitiesWithOperatorType_quantityType_maximumQuantity(
            operator_type: NSPredicateOperatorType,
            quantity_type: &HKQuantityType,
            maximum_quantity: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "HealthKit_HKQuantity",
            feature = "HealthKit_HKQuantityType"
        ))]
        #[method_id(@__retain_semantics Other predicateForWorkoutActivitiesWithOperatorType:quantityType:averageQuantity:)]
        pub unsafe fn predicateForWorkoutActivitiesWithOperatorType_quantityType_averageQuantity(
            operator_type: NSPredicateOperatorType,
            quantity_type: &HKQuantityType,
            average_quantity: &HKQuantity,
        ) -> Id<NSPredicate>;

        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicateForWorkoutsWithActivityPredicate:)]
        pub unsafe fn predicateForWorkoutsWithActivityPredicate(
            activity_predicate: &NSPredicate,
        ) -> Id<NSPredicate>;
    }
);

extern_methods!(
    /// HKActivitySummaryPredicates
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(all(
            feature = "Foundation_NSDateComponents",
            feature = "Foundation_NSPredicate"
        ))]
        #[method_id(@__retain_semantics Other predicateForActivitySummaryWithDateComponents:)]
        pub unsafe fn predicateForActivitySummaryWithDateComponents(
            date_components: &NSDateComponents,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSDateComponents",
            feature = "Foundation_NSPredicate"
        ))]
        #[method_id(@__retain_semantics Other predicateForActivitySummariesBetweenStartDateComponents:endDateComponents:)]
        pub unsafe fn predicateForActivitySummariesBetweenStartDateComponents_endDateComponents(
            start_date_components: &NSDateComponents,
            end_date_components: &NSDateComponents,
        ) -> Id<NSPredicate>;
    }
);

extern_methods!(
    /// HKClinicalRecordPredicates
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicateForClinicalRecordsWithFHIRResourceType:)]
        pub unsafe fn predicateForClinicalRecordsWithFHIRResourceType(
            resource_type: &HKFHIRResourceType,
        ) -> Id<NSPredicate>;

        #[cfg(all(
            feature = "Foundation_NSPredicate",
            feature = "Foundation_NSString",
            feature = "HealthKit_HKSource"
        ))]
        #[method_id(@__retain_semantics Other predicateForClinicalRecordsFromSource:FHIRResourceType:identifier:)]
        pub unsafe fn predicateForClinicalRecordsFromSource_FHIRResourceType_identifier(
            source: &HKSource,
            resource_type: &HKFHIRResourceType,
            identifier: &NSString,
        ) -> Id<NSPredicate>;
    }
);

extern_methods!(
    /// HKElectrocardiogramPredicates
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicateForElectrocardiogramsWithClassification:)]
        pub unsafe fn predicateForElectrocardiogramsWithClassification(
            classification: HKElectrocardiogramClassification,
        ) -> Id<NSPredicate>;

        #[cfg(feature = "Foundation_NSPredicate")]
        #[method_id(@__retain_semantics Other predicateForElectrocardiogramsWithSymptomsStatus:)]
        pub unsafe fn predicateForElectrocardiogramsWithSymptomsStatus(
            symptoms_status: HKElectrocardiogramSymptomsStatus,
        ) -> Id<NSPredicate>;
    }
);

extern_methods!(
    /// HKVerifiableClinicalRecordPredicates
    #[cfg(feature = "HealthKit_HKQuery")]
    unsafe impl HKQuery {
        #[cfg(all(
            feature = "Foundation_NSDateInterval",
            feature = "Foundation_NSPredicate"
        ))]
        #[method_id(@__retain_semantics Other predicateForVerifiableClinicalRecordsWithRelevantDateWithinDateInterval:)]
        pub unsafe fn predicateForVerifiableClinicalRecordsWithRelevantDateWithinDateInterval(
            date_interval: &NSDateInterval,
        ) -> Id<NSPredicate>;
    }
);