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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkobserverquerycompletionhandler?language=objc)
#[cfg(feature = "block2")]
pub type HKObserverQueryCompletionHandler = *mut block2::DynBlock<dyn Fn()>;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkobserverquery?language=objc)
#[unsafe(super(HKQuery, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "HKQuery")]
pub struct HKObserverQuery;
);
#[cfg(feature = "HKQuery")]
unsafe impl Send for HKObserverQuery {}
#[cfg(feature = "HKQuery")]
unsafe impl Sync for HKObserverQuery {}
#[cfg(feature = "HKQuery")]
extern_conformance!(
unsafe impl NSObjectProtocol for HKObserverQuery {}
);
#[cfg(feature = "HKQuery")]
impl HKObserverQuery {
extern_methods!(
#[cfg(all(feature = "HKObjectType", feature = "block2"))]
/// This method installs a handler that is called when a sample type has a new sample added.
///
/// If you have subscribed to background updates you must call the passed completion block
/// once you have processed data from this notification. Otherwise the system will continue
/// to notify you of this data.
///
/// # Safety
///
/// `update_handler` block must be sendable.
#[unsafe(method(initWithSampleType:predicate:updateHandler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithSampleType_predicate_updateHandler(
this: Allocated<Self>,
sample_type: &HKSampleType,
predicate: Option<&NSPredicate>,
update_handler: &block2::DynBlock<
dyn Fn(NonNull<HKObserverQuery>, HKObserverQueryCompletionHandler, *mut NSError),
>,
) -> Retained<Self>;
#[cfg(all(
feature = "HKObjectType",
feature = "HKQueryDescriptor",
feature = "block2"
))]
/// This method installs a handler that is called when a sample matching the query descriptors is added.
///
/// If you have subscribed to background updates you must call the passed completion block
/// once you have processed data from this notification. Otherwise the system will continue
/// to notify you of this data.
///
///
/// Parameter `queryDescriptors`: An array of query descriptors that describes the sample types and predicates for
/// which you are interested in getting notified.
///
/// # Safety
///
/// `update_handler` block must be sendable.
#[unsafe(method(initWithQueryDescriptors:updateHandler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithQueryDescriptors_updateHandler(
this: Allocated<Self>,
query_descriptors: &NSArray<HKQueryDescriptor>,
update_handler: &block2::DynBlock<
dyn Fn(
NonNull<HKObserverQuery>,
*mut NSSet<HKSampleType>,
HKObserverQueryCompletionHandler,
*mut NSError,
),
>,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `HKQuery`.
#[cfg(feature = "HKQuery")]
impl HKObserverQuery {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "HKQuery")]
impl HKObserverQuery {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}