objc2_watch_kit/generated/
WKApplication.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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    /// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkapplication?language=objc)
20    #[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        /// Setter for [`isAutorotating`][Self::isAutorotating].
78        #[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
105/// Methods declared on superclass `NSObject`.
106impl 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    /// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkapplicationdelegate?language=objc)
116    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        /// # Safety
168        ///
169        /// `user_info` generic should be of the correct type.
170        #[optional]
171        #[unsafe(method(handleUserActivity:))]
172        #[unsafe(method_family = none)]
173        unsafe fn handleUserActivity(&self, user_info: Option<&NSDictionary>);
174
175        #[optional]
176        #[unsafe(method(handleActivity:))]
177        #[unsafe(method_family = none)]
178        unsafe fn handleActivity(&self, user_activity: &NSUserActivity);
179
180        #[cfg(all(feature = "block2", feature = "objc2-intents"))]
181        #[optional]
182        #[unsafe(method(handleIntent:completionHandler:))]
183        #[unsafe(method_family = none)]
184        unsafe fn handleIntent_completionHandler(
185            &self,
186            intent: &INIntent,
187            completion_handler: &block2::DynBlock<dyn Fn(NonNull<INIntentResponse>)>,
188        );
189
190        #[cfg(feature = "WKBackgroundTask")]
191        #[optional]
192        #[unsafe(method(handleBackgroundTasks:))]
193        #[unsafe(method_family = none)]
194        unsafe fn handleBackgroundTasks(&self, background_tasks: &NSSet<WKRefreshBackgroundTask>);
195
196        #[optional]
197        #[unsafe(method(deviceOrientationDidChange))]
198        #[unsafe(method_family = none)]
199        unsafe fn deviceOrientationDidChange(&self);
200
201        #[optional]
202        #[unsafe(method(didRegisterForRemoteNotificationsWithDeviceToken:))]
203        #[unsafe(method_family = none)]
204        unsafe fn didRegisterForRemoteNotificationsWithDeviceToken(&self, device_token: &NSData);
205
206        #[optional]
207        #[unsafe(method(didFailToRegisterForRemoteNotificationsWithError:))]
208        #[unsafe(method_family = none)]
209        unsafe fn didFailToRegisterForRemoteNotificationsWithError(&self, error: &NSError);
210
211        #[cfg(all(feature = "WKExtension", feature = "block2"))]
212        /// This delegate method offers an opportunity for applications with the "remote-notification" background mode to fetch appropriate new data in response to an incoming remote notification. You should call the fetchCompletionHandler as soon as you're finished performing that operation, so the system can accurately estimate its power and data cost.
213        ///
214        /// This method will be invoked even if the application was launched or resumed because of the remote background notification.!
215        ///
216        /// # Safety
217        ///
218        /// `user_info` generic should be of the correct type.
219        #[optional]
220        #[unsafe(method(didReceiveRemoteNotification:fetchCompletionHandler:))]
221        #[unsafe(method_family = none)]
222        unsafe fn didReceiveRemoteNotification_fetchCompletionHandler(
223            &self,
224            user_info: &NSDictionary,
225            completion_handler: &block2::DynBlock<dyn Fn(WKBackgroundFetchResult)>,
226        );
227
228        #[cfg(feature = "objc2-cloud-kit")]
229        #[optional]
230        #[unsafe(method(userDidAcceptCloudKitShareWithMetadata:))]
231        #[unsafe(method_family = none)]
232        unsafe fn userDidAcceptCloudKitShareWithMetadata(
233            &self,
234            cloud_kit_share_metadata: &CKShareMetadata,
235        );
236    }
237);