objc2_watch_kit/generated/
WKApplication.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-cloud-kit")]
7use objc2_cloud_kit::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-health-kit")]
10use objc2_health_kit::*;
11#[cfg(feature = "objc2-intents")]
12use objc2_intents::*;
13#[cfg(feature = "objc2-ui-kit")]
14use objc2_ui_kit::*;
15
16use crate::*;
17
18extern_class!(
19 #[unsafe(super(NSObject))]
21 #[thread_kind = MainThreadOnly]
22 #[derive(Debug, PartialEq, Eq, Hash)]
23 pub struct WKApplication;
24);
25
26extern_conformance!(
27 unsafe impl NSObjectProtocol for WKApplication {}
28);
29
30impl WKApplication {
31 extern_methods!(
32 #[unsafe(method(sharedApplication))]
33 #[unsafe(method_family = none)]
34 pub unsafe fn sharedApplication(mtm: MainThreadMarker) -> Retained<WKApplication>;
35
36 #[unsafe(method(init))]
37 #[unsafe(method_family = init)]
38 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
39
40 #[unsafe(method(new))]
41 #[unsafe(method_family = new)]
42 pub unsafe fn new(&self) -> Retained<Self>;
43
44 #[unsafe(method(openSystemURL:))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn openSystemURL(&self, url: &NSURL);
47
48 #[unsafe(method(delegate))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn delegate(
51 &self,
52 ) -> Option<Retained<ProtocolObject<dyn WKApplicationDelegate>>>;
53
54 #[cfg(feature = "WKInterfaceController")]
55 #[unsafe(method(rootInterfaceController))]
56 #[unsafe(method_family = none)]
57 pub unsafe fn rootInterfaceController(&self) -> Option<Retained<WKInterfaceController>>;
58
59 #[cfg(feature = "WKInterfaceController")]
60 #[unsafe(method(visibleInterfaceController))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn visibleInterfaceController(&self) -> Option<Retained<WKInterfaceController>>;
63
64 #[cfg(feature = "WKExtension")]
65 #[unsafe(method(applicationState))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn applicationState(&self) -> WKApplicationState;
68
69 #[unsafe(method(isApplicationRunningInDock))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn isApplicationRunningInDock(&self) -> bool;
72
73 #[unsafe(method(isAutorotating))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn isAutorotating(&self) -> bool;
76
77 #[unsafe(method(setAutorotating:))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn setAutorotating(&self, autorotating: bool);
81
82 #[unsafe(method(isAutorotated))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn isAutorotated(&self) -> bool;
85
86 #[unsafe(method(registerForRemoteNotifications))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn registerForRemoteNotifications(&self);
89
90 #[unsafe(method(unregisterForRemoteNotifications))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn unregisterForRemoteNotifications(&self);
93
94 #[unsafe(method(isRegisteredForRemoteNotifications))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn isRegisteredForRemoteNotifications(&self) -> bool;
97
98 #[cfg(feature = "objc2-ui-kit")]
99 #[unsafe(method(globalTintColor))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn globalTintColor(&self) -> Retained<UIColor>;
102 );
103}
104
105impl WKApplication {
107 extern_methods!(
108 #[unsafe(method(new))]
109 #[unsafe(method_family = new)]
110 pub unsafe fn new_class(mtm: MainThreadMarker) -> Retained<Self>;
111 );
112}
113
114extern_protocol!(
115 pub unsafe trait WKApplicationDelegate: NSObjectProtocol + MainThreadOnly {
117 #[optional]
118 #[unsafe(method(applicationDidFinishLaunching))]
119 #[unsafe(method_family = none)]
120 unsafe fn applicationDidFinishLaunching(&self);
121
122 #[optional]
123 #[unsafe(method(applicationDidBecomeActive))]
124 #[unsafe(method_family = none)]
125 unsafe fn applicationDidBecomeActive(&self);
126
127 #[optional]
128 #[unsafe(method(applicationWillResignActive))]
129 #[unsafe(method_family = none)]
130 unsafe fn applicationWillResignActive(&self);
131
132 #[optional]
133 #[unsafe(method(applicationWillEnterForeground))]
134 #[unsafe(method_family = none)]
135 unsafe fn applicationWillEnterForeground(&self);
136
137 #[optional]
138 #[unsafe(method(applicationDidEnterBackground))]
139 #[unsafe(method_family = none)]
140 unsafe fn applicationDidEnterBackground(&self);
141
142 #[cfg(feature = "objc2-health-kit")]
143 #[optional]
144 #[unsafe(method(handleWorkoutConfiguration:))]
145 #[unsafe(method_family = none)]
146 unsafe fn handleWorkoutConfiguration(&self, workout_configuration: &HKWorkoutConfiguration);
147
148 #[optional]
149 #[unsafe(method(handleActiveWorkoutRecovery))]
150 #[unsafe(method_family = none)]
151 unsafe fn handleActiveWorkoutRecovery(&self);
152
153 #[cfg(feature = "WKExtendedRuntimeSession")]
154 #[optional]
155 #[unsafe(method(handleExtendedRuntimeSession:))]
156 #[unsafe(method_family = none)]
157 unsafe fn handleExtendedRuntimeSession(
158 &self,
159 extended_runtime_session: &WKExtendedRuntimeSession,
160 );
161
162 #[optional]
163 #[unsafe(method(handleRemoteNowPlayingActivity))]
164 #[unsafe(method_family = none)]
165 unsafe fn handleRemoteNowPlayingActivity(&self);
166
167 #[optional]
168 #[unsafe(method(handleUserActivity:))]
169 #[unsafe(method_family = none)]
170 unsafe fn handleUserActivity(&self, user_info: Option<&NSDictionary>);
171
172 #[optional]
173 #[unsafe(method(handleActivity:))]
174 #[unsafe(method_family = none)]
175 unsafe fn handleActivity(&self, user_activity: &NSUserActivity);
176
177 #[cfg(all(feature = "block2", feature = "objc2-intents"))]
178 #[optional]
179 #[unsafe(method(handleIntent:completionHandler:))]
180 #[unsafe(method_family = none)]
181 unsafe fn handleIntent_completionHandler(
182 &self,
183 intent: &INIntent,
184 completion_handler: &block2::DynBlock<dyn Fn(NonNull<INIntentResponse>)>,
185 );
186
187 #[cfg(feature = "WKBackgroundTask")]
188 #[optional]
189 #[unsafe(method(handleBackgroundTasks:))]
190 #[unsafe(method_family = none)]
191 unsafe fn handleBackgroundTasks(&self, background_tasks: &NSSet<WKRefreshBackgroundTask>);
192
193 #[optional]
194 #[unsafe(method(deviceOrientationDidChange))]
195 #[unsafe(method_family = none)]
196 unsafe fn deviceOrientationDidChange(&self);
197
198 #[optional]
199 #[unsafe(method(didRegisterForRemoteNotificationsWithDeviceToken:))]
200 #[unsafe(method_family = none)]
201 unsafe fn didRegisterForRemoteNotificationsWithDeviceToken(&self, device_token: &NSData);
202
203 #[optional]
204 #[unsafe(method(didFailToRegisterForRemoteNotificationsWithError:))]
205 #[unsafe(method_family = none)]
206 unsafe fn didFailToRegisterForRemoteNotificationsWithError(&self, error: &NSError);
207
208 #[cfg(all(feature = "WKExtension", feature = "block2"))]
209 #[optional]
213 #[unsafe(method(didReceiveRemoteNotification:fetchCompletionHandler:))]
214 #[unsafe(method_family = none)]
215 unsafe fn didReceiveRemoteNotification_fetchCompletionHandler(
216 &self,
217 user_info: &NSDictionary,
218 completion_handler: &block2::DynBlock<dyn Fn(WKBackgroundFetchResult)>,
219 );
220
221 #[cfg(feature = "objc2-cloud-kit")]
222 #[optional]
223 #[unsafe(method(userDidAcceptCloudKitShareWithMetadata:))]
224 #[unsafe(method_family = none)]
225 unsafe fn userDidAcceptCloudKitShareWithMetadata(
226 &self,
227 cloud_kit_share_metadata: &CKShareMetadata,
228 );
229 }
230);