1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-cloud-kit")]
7use objc2_cloud_kit::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct UIStatusBarStyle(pub NSInteger);
19impl UIStatusBarStyle {
20 #[doc(alias = "UIStatusBarStyleDefault")]
21 pub const Default: Self = Self(0);
22 #[doc(alias = "UIStatusBarStyleLightContent")]
23 pub const LightContent: Self = Self(1);
24 #[doc(alias = "UIStatusBarStyleDarkContent")]
25 pub const DarkContent: Self = Self(3);
26 #[deprecated]
27 #[doc(alias = "UIStatusBarStyleBlackTranslucent")]
28 pub const BlackTranslucent: Self = Self(1);
29 #[deprecated]
30 #[doc(alias = "UIStatusBarStyleBlackOpaque")]
31 pub const BlackOpaque: Self = Self(2);
32}
33
34unsafe impl Encode for UIStatusBarStyle {
35 const ENCODING: Encoding = NSInteger::ENCODING;
36}
37
38unsafe impl RefEncode for UIStatusBarStyle {
39 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
40}
41
42#[repr(transparent)]
45#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
46pub struct UIStatusBarAnimation(pub NSInteger);
47impl UIStatusBarAnimation {
48 #[doc(alias = "UIStatusBarAnimationNone")]
49 pub const None: Self = Self(0);
50 #[doc(alias = "UIStatusBarAnimationFade")]
51 pub const Fade: Self = Self(1);
52 #[doc(alias = "UIStatusBarAnimationSlide")]
53 pub const Slide: Self = Self(2);
54}
55
56unsafe impl Encode for UIStatusBarAnimation {
57 const ENCODING: Encoding = NSInteger::ENCODING;
58}
59
60unsafe impl RefEncode for UIStatusBarAnimation {
61 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
62}
63
64extern "C" {
65 pub static UIApplicationInvalidInterfaceOrientationException: &'static NSExceptionName;
67}
68
69#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
72#[repr(transparent)]
73#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
74pub struct UIRemoteNotificationType(pub NSUInteger);
75bitflags::bitflags! {
76 impl UIRemoteNotificationType: NSUInteger {
77#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
78 #[doc(alias = "UIRemoteNotificationTypeNone")]
79 const None = 0;
80#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
81 #[doc(alias = "UIRemoteNotificationTypeBadge")]
82 const Badge = 1<<0;
83#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
84 #[doc(alias = "UIRemoteNotificationTypeSound")]
85 const Sound = 1<<1;
86#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
87 #[doc(alias = "UIRemoteNotificationTypeAlert")]
88 const Alert = 1<<2;
89#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
90 #[doc(alias = "UIRemoteNotificationTypeNewsstandContentAvailability")]
91 const NewsstandContentAvailability = 1<<3;
92 }
93}
94
95unsafe impl Encode for UIRemoteNotificationType {
96 const ENCODING: Encoding = NSUInteger::ENCODING;
97}
98
99unsafe impl RefEncode for UIRemoteNotificationType {
100 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
101}
102
103#[repr(transparent)]
106#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
107pub struct UIBackgroundFetchResult(pub NSUInteger);
108impl UIBackgroundFetchResult {
109 #[doc(alias = "UIBackgroundFetchResultNewData")]
110 pub const NewData: Self = Self(0);
111 #[doc(alias = "UIBackgroundFetchResultNoData")]
112 pub const NoData: Self = Self(1);
113 #[doc(alias = "UIBackgroundFetchResultFailed")]
114 pub const Failed: Self = Self(2);
115}
116
117unsafe impl Encode for UIBackgroundFetchResult {
118 const ENCODING: Encoding = NSUInteger::ENCODING;
119}
120
121unsafe impl RefEncode for UIBackgroundFetchResult {
122 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
123}
124
125#[repr(transparent)]
128#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
129pub struct UIBackgroundRefreshStatus(pub NSInteger);
130impl UIBackgroundRefreshStatus {
131 #[doc(alias = "UIBackgroundRefreshStatusRestricted")]
132 pub const Restricted: Self = Self(0);
133 #[doc(alias = "UIBackgroundRefreshStatusDenied")]
134 pub const Denied: Self = Self(1);
135 #[doc(alias = "UIBackgroundRefreshStatusAvailable")]
136 pub const Available: Self = Self(2);
137}
138
139unsafe impl Encode for UIBackgroundRefreshStatus {
140 const ENCODING: Encoding = NSInteger::ENCODING;
141}
142
143unsafe impl RefEncode for UIBackgroundRefreshStatus {
144 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
145}
146
147#[repr(transparent)]
150#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
151pub struct UIApplicationState(pub NSInteger);
152impl UIApplicationState {
153 #[doc(alias = "UIApplicationStateActive")]
154 pub const Active: Self = Self(0);
155 #[doc(alias = "UIApplicationStateInactive")]
156 pub const Inactive: Self = Self(1);
157 #[doc(alias = "UIApplicationStateBackground")]
158 pub const Background: Self = Self(2);
159}
160
161unsafe impl Encode for UIApplicationState {
162 const ENCODING: Encoding = NSInteger::ENCODING;
163}
164
165unsafe impl RefEncode for UIApplicationState {
166 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
167}
168
169pub type UIBackgroundTaskIdentifier = NSUInteger;
172
173extern "C" {
174 pub static UIBackgroundTaskInvalid: UIBackgroundTaskIdentifier;
176}
177
178extern "C" {
179 pub static UIMinimumKeepAliveTimeout: NSTimeInterval;
181}
182
183extern "C" {
184 pub static UIApplicationBackgroundFetchIntervalMinimum: NSTimeInterval;
186}
187
188extern "C" {
189 pub static UIApplicationBackgroundFetchIntervalNever: NSTimeInterval;
191}
192
193pub type UIApplicationOpenExternalURLOptionsKey = NSString;
196
197extern_class!(
198 #[unsafe(super(UIResponder, NSObject))]
200 #[thread_kind = MainThreadOnly]
201 #[derive(Debug, PartialEq, Eq, Hash)]
202 #[cfg(feature = "UIResponder")]
203 pub struct UIApplication;
204);
205
206#[cfg(feature = "UIResponder")]
207unsafe impl NSObjectProtocol for UIApplication {}
208
209#[cfg(feature = "UIResponder")]
210unsafe impl UIResponderStandardEditActions for UIApplication {}
211
212#[cfg(feature = "UIResponder")]
213impl UIApplication {
214 extern_methods!(
215 #[unsafe(method(sharedApplication))]
216 #[unsafe(method_family = none)]
217 pub fn sharedApplication(mtm: MainThreadMarker) -> Retained<UIApplication>;
218
219 #[unsafe(method(delegate))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn delegate(
222 &self,
223 ) -> Option<Retained<ProtocolObject<dyn UIApplicationDelegate>>>;
224
225 #[unsafe(method(setDelegate:))]
227 #[unsafe(method_family = none)]
228 pub unsafe fn setDelegate(
229 &self,
230 delegate: Option<&ProtocolObject<dyn UIApplicationDelegate>>,
231 );
232
233 #[deprecated = "Use UIView's userInteractionEnabled property instead"]
234 #[unsafe(method(beginIgnoringInteractionEvents))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn beginIgnoringInteractionEvents(&self);
237
238 #[deprecated = "Use UIView's userInteractionEnabled property instead"]
239 #[unsafe(method(endIgnoringInteractionEvents))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn endIgnoringInteractionEvents(&self);
242
243 #[deprecated = "Use UIView's userInteractionEnabled property instead"]
244 #[unsafe(method(isIgnoringInteractionEvents))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn isIgnoringInteractionEvents(&self) -> bool;
247
248 #[unsafe(method(isIdleTimerDisabled))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn isIdleTimerDisabled(&self) -> bool;
251
252 #[unsafe(method(setIdleTimerDisabled:))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn setIdleTimerDisabled(&self, idle_timer_disabled: bool);
256
257 #[deprecated]
258 #[unsafe(method(openURL:))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn openURL(&self, url: &NSURL) -> bool;
261
262 #[unsafe(method(canOpenURL:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn canOpenURL(&self, url: &NSURL) -> bool;
265
266 #[cfg(feature = "block2")]
267 #[unsafe(method(openURL:options:completionHandler:))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn openURL_options_completionHandler(
270 &self,
271 url: &NSURL,
272 options: &NSDictionary<UIApplicationOpenExternalURLOptionsKey, AnyObject>,
273 completion: Option<&block2::Block<dyn Fn(Bool)>>,
274 );
275
276 #[cfg(feature = "UIEvent")]
277 #[unsafe(method(sendEvent:))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn sendEvent(&self, event: &UIEvent);
280
281 #[cfg(all(feature = "UIView", feature = "UIWindow"))]
282 #[deprecated = "Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes"]
283 #[unsafe(method(keyWindow))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn keyWindow(&self) -> Option<Retained<UIWindow>>;
286
287 #[cfg(all(feature = "UIView", feature = "UIWindow"))]
288 #[deprecated = "Use UIWindowScene.windows on a relevant window scene instead"]
289 #[unsafe(method(windows))]
290 #[unsafe(method_family = none)]
291 pub fn windows(&self) -> Retained<NSArray<UIWindow>>;
292
293 #[cfg(feature = "UIEvent")]
294 #[unsafe(method(sendAction:to:from:forEvent:))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn sendAction_to_from_forEvent(
297 &self,
298 action: Sel,
299 target: Option<&AnyObject>,
300 sender: Option<&AnyObject>,
301 event: Option<&UIEvent>,
302 ) -> bool;
303
304 #[deprecated = "Provide a custom network activity UI in your app if desired."]
305 #[unsafe(method(isNetworkActivityIndicatorVisible))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn isNetworkActivityIndicatorVisible(&self) -> bool;
308
309 #[deprecated = "Provide a custom network activity UI in your app if desired."]
311 #[unsafe(method(setNetworkActivityIndicatorVisible:))]
312 #[unsafe(method_family = none)]
313 pub unsafe fn setNetworkActivityIndicatorVisible(
314 &self,
315 network_activity_indicator_visible: bool,
316 );
317
318 #[cfg(all(feature = "UIOrientation", feature = "UIView", feature = "UIWindow"))]
319 #[unsafe(method(supportedInterfaceOrientationsForWindow:))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn supportedInterfaceOrientationsForWindow(
322 &self,
323 window: Option<&UIWindow>,
324 ) -> UIInterfaceOrientationMask;
325
326 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
327 #[unsafe(method(statusBarOrientationAnimationDuration))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn statusBarOrientationAnimationDuration(&self) -> NSTimeInterval;
330
331 #[cfg(feature = "objc2-core-foundation")]
332 #[deprecated = "Use the statusBarManager property of the window scene instead."]
333 #[unsafe(method(statusBarFrame))]
334 #[unsafe(method_family = none)]
335 pub fn statusBarFrame(&self) -> CGRect;
336
337 #[deprecated = "Use -[UNUserNotificationCenter setBadgeCount:withCompletionHandler:] instead."]
338 #[unsafe(method(applicationIconBadgeNumber))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn applicationIconBadgeNumber(&self) -> NSInteger;
341
342 #[deprecated = "Use -[UNUserNotificationCenter setBadgeCount:withCompletionHandler:] instead."]
344 #[unsafe(method(setApplicationIconBadgeNumber:))]
345 #[unsafe(method_family = none)]
346 pub unsafe fn setApplicationIconBadgeNumber(
347 &self,
348 application_icon_badge_number: NSInteger,
349 );
350
351 #[unsafe(method(applicationSupportsShakeToEdit))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn applicationSupportsShakeToEdit(&self) -> bool;
354
355 #[unsafe(method(setApplicationSupportsShakeToEdit:))]
357 #[unsafe(method_family = none)]
358 pub unsafe fn setApplicationSupportsShakeToEdit(
359 &self,
360 application_supports_shake_to_edit: bool,
361 );
362
363 #[unsafe(method(applicationState))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn applicationState(&self) -> UIApplicationState;
366
367 #[unsafe(method(backgroundTimeRemaining))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn backgroundTimeRemaining(&self) -> NSTimeInterval;
370
371 #[cfg(feature = "block2")]
372 #[unsafe(method(beginBackgroundTaskWithExpirationHandler:))]
373 #[unsafe(method_family = none)]
374 pub unsafe fn beginBackgroundTaskWithExpirationHandler(
375 &self,
376 handler: Option<&block2::Block<dyn Fn()>>,
377 ) -> UIBackgroundTaskIdentifier;
378
379 #[cfg(feature = "block2")]
380 #[unsafe(method(beginBackgroundTaskWithName:expirationHandler:))]
381 #[unsafe(method_family = none)]
382 pub unsafe fn beginBackgroundTaskWithName_expirationHandler(
383 &self,
384 task_name: Option<&NSString>,
385 handler: Option<&block2::Block<dyn Fn()>>,
386 ) -> UIBackgroundTaskIdentifier;
387
388 #[unsafe(method(endBackgroundTask:))]
389 #[unsafe(method_family = none)]
390 pub unsafe fn endBackgroundTask(&self, identifier: UIBackgroundTaskIdentifier);
391
392 #[deprecated = "Use a BGAppRefreshTask in the BackgroundTasks framework instead"]
401 #[unsafe(method(setMinimumBackgroundFetchInterval:))]
402 #[unsafe(method_family = none)]
403 pub unsafe fn setMinimumBackgroundFetchInterval(
404 &self,
405 minimum_background_fetch_interval: NSTimeInterval,
406 );
407
408 #[unsafe(method(backgroundRefreshStatus))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn backgroundRefreshStatus(&self) -> UIBackgroundRefreshStatus;
414
415 #[unsafe(method(isProtectedDataAvailable))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn isProtectedDataAvailable(&self) -> bool;
418
419 #[cfg(feature = "UIInterface")]
420 #[unsafe(method(userInterfaceLayoutDirection))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn userInterfaceLayoutDirection(&self) -> UIUserInterfaceLayoutDirection;
423
424 #[cfg(feature = "UIContentSizeCategory")]
425 #[unsafe(method(preferredContentSizeCategory))]
426 #[unsafe(method_family = none)]
427 pub unsafe fn preferredContentSizeCategory(&self) -> Retained<UIContentSizeCategory>;
428
429 #[cfg(feature = "UIScene")]
430 #[unsafe(method(connectedScenes))]
431 #[unsafe(method_family = none)]
432 pub unsafe fn connectedScenes(&self) -> Retained<NSSet<UIScene>>;
433
434 #[cfg(feature = "UISceneSession")]
435 #[unsafe(method(openSessions))]
436 #[unsafe(method_family = none)]
437 pub unsafe fn openSessions(&self) -> Retained<NSSet<UISceneSession>>;
438
439 #[unsafe(method(supportsMultipleScenes))]
440 #[unsafe(method_family = none)]
441 pub unsafe fn supportsMultipleScenes(&self) -> bool;
442
443 #[cfg(all(feature = "UISceneSessionActivationRequest", feature = "block2"))]
444 #[unsafe(method(activateSceneSessionForRequest:errorHandler:))]
449 #[unsafe(method_family = none)]
450 pub unsafe fn activateSceneSessionForRequest_errorHandler(
451 &self,
452 request: &UISceneSessionActivationRequest,
453 error_handler: Option<&block2::Block<dyn Fn(NonNull<NSError>)>>,
454 );
455
456 #[cfg(all(
457 feature = "UISceneOptions",
458 feature = "UISceneSession",
459 feature = "block2"
460 ))]
461 #[deprecated = "Please use activateSceneSessionForRequest:errorHandler:"]
462 #[unsafe(method(requestSceneSessionActivation:userActivity:options:errorHandler:))]
463 #[unsafe(method_family = none)]
464 pub unsafe fn requestSceneSessionActivation_userActivity_options_errorHandler(
465 &self,
466 scene_session: Option<&UISceneSession>,
467 user_activity: Option<&NSUserActivity>,
468 options: Option<&UISceneActivationRequestOptions>,
469 error_handler: Option<&block2::Block<dyn Fn(NonNull<NSError>)>>,
470 );
471
472 #[cfg(all(
473 feature = "UISceneOptions",
474 feature = "UISceneSession",
475 feature = "block2"
476 ))]
477 #[unsafe(method(requestSceneSessionDestruction:options:errorHandler:))]
478 #[unsafe(method_family = none)]
479 pub unsafe fn requestSceneSessionDestruction_options_errorHandler(
480 &self,
481 scene_session: &UISceneSession,
482 options: Option<&UISceneDestructionRequestOptions>,
483 error_handler: Option<&block2::Block<dyn Fn(NonNull<NSError>)>>,
484 );
485
486 #[cfg(feature = "UISceneSession")]
487 #[unsafe(method(requestSceneSessionRefresh:))]
488 #[unsafe(method_family = none)]
489 pub unsafe fn requestSceneSessionRefresh(&self, scene_session: &UISceneSession);
490 );
491}
492
493#[cfg(feature = "UIResponder")]
495impl UIApplication {
496 extern_methods!(
497 #[unsafe(method(init))]
498 #[unsafe(method_family = init)]
499 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
500
501 #[unsafe(method(new))]
502 #[unsafe(method_family = new)]
503 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
504 );
505}
506
507#[cfg(feature = "UIResponder")]
509impl UIApplication {
510 extern_methods!(
511 #[unsafe(method(registerForRemoteNotifications))]
512 #[unsafe(method_family = none)]
513 pub unsafe fn registerForRemoteNotifications(&self);
514
515 #[unsafe(method(unregisterForRemoteNotifications))]
516 #[unsafe(method_family = none)]
517 pub unsafe fn unregisterForRemoteNotifications(&self);
518
519 #[unsafe(method(isRegisteredForRemoteNotifications))]
520 #[unsafe(method_family = none)]
521 pub unsafe fn isRegisteredForRemoteNotifications(&self) -> bool;
522
523 #[deprecated = "Use -[UIApplication registerForRemoteNotifications] and UserNotifications Framework's -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:]"]
524 #[unsafe(method(registerForRemoteNotificationTypes:))]
525 #[unsafe(method_family = none)]
526 pub unsafe fn registerForRemoteNotificationTypes(&self, types: UIRemoteNotificationType);
527
528 #[deprecated = "Use -[UIApplication isRegisteredForRemoteNotifications] and UserNotifications Framework's -[UNUserNotificationCenter getNotificationSettingsWithCompletionHandler:] to retrieve user-enabled remote notification and user notification settings"]
529 #[unsafe(method(enabledRemoteNotificationTypes))]
530 #[unsafe(method_family = none)]
531 pub unsafe fn enabledRemoteNotificationTypes(&self) -> UIRemoteNotificationType;
532 );
533}
534
535#[cfg(feature = "UIResponder")]
537impl UIApplication {
538 extern_methods!(
539 #[cfg(feature = "UILocalNotification")]
540 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter addNotificationRequest:withCompletionHandler:]"]
541 #[unsafe(method(presentLocalNotificationNow:))]
542 #[unsafe(method_family = none)]
543 pub unsafe fn presentLocalNotificationNow(&self, notification: &UILocalNotification);
544
545 #[cfg(feature = "UILocalNotification")]
546 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter addNotificationRequest:withCompletionHandler:]"]
547 #[unsafe(method(scheduleLocalNotification:))]
548 #[unsafe(method_family = none)]
549 pub unsafe fn scheduleLocalNotification(&self, notification: &UILocalNotification);
550
551 #[cfg(feature = "UILocalNotification")]
552 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter removePendingNotificationRequestsWithIdentifiers:]"]
553 #[unsafe(method(cancelLocalNotification:))]
554 #[unsafe(method_family = none)]
555 pub unsafe fn cancelLocalNotification(&self, notification: &UILocalNotification);
556
557 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter removeAllPendingNotificationRequests]"]
558 #[unsafe(method(cancelAllLocalNotifications))]
559 #[unsafe(method_family = none)]
560 pub unsafe fn cancelAllLocalNotifications(&self);
561
562 #[cfg(feature = "UILocalNotification")]
563 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter getPendingNotificationRequestsWithCompletionHandler:]"]
564 #[unsafe(method(scheduledLocalNotifications))]
565 #[unsafe(method_family = none)]
566 pub unsafe fn scheduledLocalNotifications(
567 &self,
568 ) -> Option<Retained<NSArray<UILocalNotification>>>;
569
570 #[cfg(feature = "UILocalNotification")]
571 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter getPendingNotificationRequestsWithCompletionHandler:]"]
573 #[unsafe(method(setScheduledLocalNotifications:))]
574 #[unsafe(method_family = none)]
575 pub unsafe fn setScheduledLocalNotifications(
576 &self,
577 scheduled_local_notifications: Option<&NSArray<UILocalNotification>>,
578 );
579 );
580}
581
582#[cfg(feature = "UIResponder")]
584impl UIApplication {
585 extern_methods!(
586 #[cfg(feature = "UIUserNotificationSettings")]
587 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:] and -[UNUserNotificationCenter setNotificationCategories:]"]
588 #[unsafe(method(registerUserNotificationSettings:))]
589 #[unsafe(method_family = none)]
590 pub unsafe fn registerUserNotificationSettings(
591 &self,
592 notification_settings: &UIUserNotificationSettings,
593 );
594
595 #[cfg(feature = "UIUserNotificationSettings")]
596 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter getNotificationSettingsWithCompletionHandler:] and -[UNUserNotificationCenter getNotificationCategoriesWithCompletionHandler:]"]
597 #[unsafe(method(currentUserNotificationSettings))]
598 #[unsafe(method_family = none)]
599 pub unsafe fn currentUserNotificationSettings(
600 &self,
601 ) -> Option<Retained<UIUserNotificationSettings>>;
602 );
603}
604
605#[cfg(feature = "UIResponder")]
607impl UIApplication {
608 extern_methods!(
609 #[unsafe(method(beginReceivingRemoteControlEvents))]
610 #[unsafe(method_family = none)]
611 pub unsafe fn beginReceivingRemoteControlEvents(&self);
612
613 #[unsafe(method(endReceivingRemoteControlEvents))]
614 #[unsafe(method_family = none)]
615 pub unsafe fn endReceivingRemoteControlEvents(&self);
616 );
617}
618
619#[cfg(feature = "UIResponder")]
621impl UIApplication {
622 extern_methods!(
623 #[cfg(feature = "UIImage")]
624 #[deprecated = "Newsstand apps now behave like normal apps on SpringBoard"]
625 #[unsafe(method(setNewsstandIconImage:))]
626 #[unsafe(method_family = none)]
627 pub unsafe fn setNewsstandIconImage(&self, image: Option<&UIImage>);
628 );
629}
630
631#[cfg(feature = "UIResponder")]
633impl UIApplication {
634 extern_methods!(
635 #[cfg(feature = "UIApplicationShortcutItem")]
636 #[unsafe(method(shortcutItems))]
637 #[unsafe(method_family = none)]
638 pub unsafe fn shortcutItems(&self) -> Option<Retained<NSArray<UIApplicationShortcutItem>>>;
639
640 #[cfg(feature = "UIApplicationShortcutItem")]
641 #[unsafe(method(setShortcutItems:))]
643 #[unsafe(method_family = none)]
644 pub unsafe fn setShortcutItems(
645 &self,
646 shortcut_items: Option<&NSArray<UIApplicationShortcutItem>>,
647 );
648 );
649}
650
651#[cfg(feature = "UIResponder")]
653impl UIApplication {
654 extern_methods!(
655 #[unsafe(method(supportsAlternateIcons))]
656 #[unsafe(method_family = none)]
657 pub unsafe fn supportsAlternateIcons(&self) -> bool;
658
659 #[cfg(feature = "block2")]
660 #[unsafe(method(setAlternateIconName:completionHandler:))]
661 #[unsafe(method_family = none)]
662 pub unsafe fn setAlternateIconName_completionHandler(
663 &self,
664 alternate_icon_name: Option<&NSString>,
665 completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
666 );
667
668 #[unsafe(method(alternateIconName))]
669 #[unsafe(method_family = none)]
670 pub unsafe fn alternateIconName(&self) -> Option<Retained<NSString>>;
671 );
672}
673
674#[cfg(feature = "UIResponder")]
676impl UIApplication {
677 extern_methods!(
678 #[unsafe(method(extendStateRestoration))]
679 #[unsafe(method_family = none)]
680 pub unsafe fn extendStateRestoration(&self);
681
682 #[unsafe(method(completeStateRestoration))]
683 #[unsafe(method_family = none)]
684 pub unsafe fn completeStateRestoration(&self);
685
686 #[unsafe(method(ignoreSnapshotOnNextApplicationLaunch))]
687 #[unsafe(method_family = none)]
688 pub unsafe fn ignoreSnapshotOnNextApplicationLaunch(&self);
689
690 #[cfg(feature = "UIStateRestoration")]
691 #[unsafe(method(registerObjectForStateRestoration:restorationIdentifier:))]
692 #[unsafe(method_family = none)]
693 pub unsafe fn registerObjectForStateRestoration_restorationIdentifier(
694 object: &ProtocolObject<dyn UIStateRestoring>,
695 restoration_identifier: &NSString,
696 );
697 );
698}
699
700#[repr(transparent)]
703#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
704pub struct UIApplicationCategory(pub NSInteger);
705impl UIApplicationCategory {
706 #[doc(alias = "UIApplicationCategoryWebBrowser")]
707 pub const WebBrowser: Self = Self(1);
708}
709
710unsafe impl Encode for UIApplicationCategory {
711 const ENCODING: Encoding = NSInteger::ENCODING;
712}
713
714unsafe impl RefEncode for UIApplicationCategory {
715 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
716}
717
718#[repr(transparent)]
723#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
724pub struct UIApplicationCategoryDefaultStatus(pub NSInteger);
725impl UIApplicationCategoryDefaultStatus {
726 #[doc(alias = "UIApplicationCategoryDefaultStatusUnavailable")]
728 pub const Unavailable: Self = Self(0);
729 #[doc(alias = "UIApplicationCategoryDefaultStatusIsDefault")]
731 pub const IsDefault: Self = Self(1);
732 #[doc(alias = "UIApplicationCategoryDefaultStatusNotDefault")]
734 pub const NotDefault: Self = Self(2);
735}
736
737unsafe impl Encode for UIApplicationCategoryDefaultStatus {
738 const ENCODING: Encoding = NSInteger::ENCODING;
739}
740
741unsafe impl RefEncode for UIApplicationCategoryDefaultStatus {
742 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
743}
744
745extern "C" {
746 pub static UIApplicationCategoryDefaultErrorDomain: &'static NSErrorDomain;
748}
749
750#[repr(transparent)]
753#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
754pub struct UIApplicationCategoryDefaultErrorCode(pub NSInteger);
755impl UIApplicationCategoryDefaultErrorCode {
756 #[doc(alias = "UIApplicationCategoryDefaultErrorRateLimited")]
758 pub const RateLimited: Self = Self(1);
759}
760
761unsafe impl Encode for UIApplicationCategoryDefaultErrorCode {
762 const ENCODING: Encoding = NSInteger::ENCODING;
763}
764
765unsafe impl RefEncode for UIApplicationCategoryDefaultErrorCode {
766 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
767}
768
769extern "C" {
770 pub static UIApplicationCategoryDefaultStatusLastProvidedDateErrorKey:
775 &'static NSErrorUserInfoKey;
776}
777
778extern "C" {
779 pub static UIApplicationCategoryDefaultRetryAvailabilityDateErrorKey:
784 &'static NSErrorUserInfoKey;
785}
786
787#[cfg(feature = "UIResponder")]
789impl UIApplication {
790 extern_methods!();
791}
792
793pub type UIApplicationLaunchOptionsKey = NSString;
796
797pub type UIApplicationOpenURLOptionsKey = NSString;
800
801pub type UIApplicationExtensionPointIdentifier = NSString;
804
805extern_protocol!(
806 pub unsafe trait UIApplicationDelegate: NSObjectProtocol + MainThreadOnly {
808 #[cfg(feature = "UIResponder")]
809 #[optional]
810 #[unsafe(method(applicationDidFinishLaunching:))]
811 #[unsafe(method_family = none)]
812 unsafe fn applicationDidFinishLaunching(&self, application: &UIApplication);
813
814 #[cfg(feature = "UIResponder")]
815 #[optional]
816 #[unsafe(method(application:willFinishLaunchingWithOptions:))]
817 #[unsafe(method_family = none)]
818 unsafe fn application_willFinishLaunchingWithOptions(
819 &self,
820 application: &UIApplication,
821 launch_options: Option<&NSDictionary<UIApplicationLaunchOptionsKey, AnyObject>>,
822 ) -> bool;
823
824 #[cfg(feature = "UIResponder")]
825 #[optional]
826 #[unsafe(method(application:didFinishLaunchingWithOptions:))]
827 #[unsafe(method_family = none)]
828 unsafe fn application_didFinishLaunchingWithOptions(
829 &self,
830 application: &UIApplication,
831 launch_options: Option<&NSDictionary<UIApplicationLaunchOptionsKey, AnyObject>>,
832 ) -> bool;
833
834 #[cfg(feature = "UIResponder")]
835 #[optional]
836 #[unsafe(method(applicationDidBecomeActive:))]
837 #[unsafe(method_family = none)]
838 unsafe fn applicationDidBecomeActive(&self, application: &UIApplication);
839
840 #[cfg(feature = "UIResponder")]
841 #[optional]
842 #[unsafe(method(applicationWillResignActive:))]
843 #[unsafe(method_family = none)]
844 unsafe fn applicationWillResignActive(&self, application: &UIApplication);
845
846 #[cfg(feature = "UIResponder")]
847 #[deprecated]
848 #[optional]
849 #[unsafe(method(application:handleOpenURL:))]
850 #[unsafe(method_family = none)]
851 unsafe fn application_handleOpenURL(
852 &self,
853 application: &UIApplication,
854 url: &NSURL,
855 ) -> bool;
856
857 #[cfg(feature = "UIResponder")]
858 #[deprecated]
859 #[optional]
860 #[unsafe(method(application:openURL:sourceApplication:annotation:))]
861 #[unsafe(method_family = none)]
862 unsafe fn application_openURL_sourceApplication_annotation(
863 &self,
864 application: &UIApplication,
865 url: &NSURL,
866 source_application: Option<&NSString>,
867 annotation: &AnyObject,
868 ) -> bool;
869
870 #[cfg(feature = "UIResponder")]
871 #[optional]
872 #[unsafe(method(application:openURL:options:))]
873 #[unsafe(method_family = none)]
874 unsafe fn application_openURL_options(
875 &self,
876 app: &UIApplication,
877 url: &NSURL,
878 options: &NSDictionary<UIApplicationOpenURLOptionsKey, AnyObject>,
879 ) -> bool;
880
881 #[cfg(feature = "UIResponder")]
882 #[optional]
883 #[unsafe(method(applicationDidReceiveMemoryWarning:))]
884 #[unsafe(method_family = none)]
885 unsafe fn applicationDidReceiveMemoryWarning(&self, application: &UIApplication);
886
887 #[cfg(feature = "UIResponder")]
888 #[optional]
889 #[unsafe(method(applicationWillTerminate:))]
890 #[unsafe(method_family = none)]
891 unsafe fn applicationWillTerminate(&self, application: &UIApplication);
892
893 #[cfg(feature = "UIResponder")]
894 #[optional]
895 #[unsafe(method(applicationSignificantTimeChange:))]
896 #[unsafe(method_family = none)]
897 unsafe fn applicationSignificantTimeChange(&self, application: &UIApplication);
898
899 #[cfg(all(feature = "UIOrientation", feature = "UIResponder"))]
900 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
901 #[optional]
902 #[unsafe(method(application:willChangeStatusBarOrientation:duration:))]
903 #[unsafe(method_family = none)]
904 unsafe fn application_willChangeStatusBarOrientation_duration(
905 &self,
906 application: &UIApplication,
907 new_status_bar_orientation: UIInterfaceOrientation,
908 duration: NSTimeInterval,
909 );
910
911 #[cfg(all(feature = "UIOrientation", feature = "UIResponder"))]
912 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
913 #[optional]
914 #[unsafe(method(application:didChangeStatusBarOrientation:))]
915 #[unsafe(method_family = none)]
916 unsafe fn application_didChangeStatusBarOrientation(
917 &self,
918 application: &UIApplication,
919 old_status_bar_orientation: UIInterfaceOrientation,
920 );
921
922 #[cfg(all(feature = "UIResponder", feature = "objc2-core-foundation"))]
923 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
924 #[optional]
925 #[unsafe(method(application:willChangeStatusBarFrame:))]
926 #[unsafe(method_family = none)]
927 unsafe fn application_willChangeStatusBarFrame(
928 &self,
929 application: &UIApplication,
930 new_status_bar_frame: CGRect,
931 );
932
933 #[cfg(all(feature = "UIResponder", feature = "objc2-core-foundation"))]
934 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
935 #[optional]
936 #[unsafe(method(application:didChangeStatusBarFrame:))]
937 #[unsafe(method_family = none)]
938 unsafe fn application_didChangeStatusBarFrame(
939 &self,
940 application: &UIApplication,
941 old_status_bar_frame: CGRect,
942 );
943
944 #[cfg(all(feature = "UIResponder", feature = "UIUserNotificationSettings"))]
945 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:]"]
946 #[optional]
947 #[unsafe(method(application:didRegisterUserNotificationSettings:))]
948 #[unsafe(method_family = none)]
949 unsafe fn application_didRegisterUserNotificationSettings(
950 &self,
951 application: &UIApplication,
952 notification_settings: &UIUserNotificationSettings,
953 );
954
955 #[cfg(feature = "UIResponder")]
956 #[optional]
957 #[unsafe(method(application:didRegisterForRemoteNotificationsWithDeviceToken:))]
958 #[unsafe(method_family = none)]
959 unsafe fn application_didRegisterForRemoteNotificationsWithDeviceToken(
960 &self,
961 application: &UIApplication,
962 device_token: &NSData,
963 );
964
965 #[cfg(feature = "UIResponder")]
966 #[optional]
967 #[unsafe(method(application:didFailToRegisterForRemoteNotificationsWithError:))]
968 #[unsafe(method_family = none)]
969 unsafe fn application_didFailToRegisterForRemoteNotificationsWithError(
970 &self,
971 application: &UIApplication,
972 error: &NSError,
973 );
974
975 #[cfg(feature = "UIResponder")]
976 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate willPresentNotification:withCompletionHandler:] or -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:] for user visible notifications and -[UIApplicationDelegate application:didReceiveRemoteNotification:fetchCompletionHandler:] for silent remote notifications"]
977 #[optional]
978 #[unsafe(method(application:didReceiveRemoteNotification:))]
979 #[unsafe(method_family = none)]
980 unsafe fn application_didReceiveRemoteNotification(
981 &self,
982 application: &UIApplication,
983 user_info: &NSDictionary,
984 );
985
986 #[cfg(all(feature = "UILocalNotification", feature = "UIResponder"))]
987 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate willPresentNotification:withCompletionHandler:] or -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
988 #[optional]
989 #[unsafe(method(application:didReceiveLocalNotification:))]
990 #[unsafe(method_family = none)]
991 unsafe fn application_didReceiveLocalNotification(
992 &self,
993 application: &UIApplication,
994 notification: &UILocalNotification,
995 );
996
997 #[cfg(all(
998 feature = "UILocalNotification",
999 feature = "UIResponder",
1000 feature = "block2"
1001 ))]
1002 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1003 #[optional]
1004 #[unsafe(method(application:handleActionWithIdentifier:forLocalNotification:completionHandler:))]
1005 #[unsafe(method_family = none)]
1006 unsafe fn application_handleActionWithIdentifier_forLocalNotification_completionHandler(
1007 &self,
1008 application: &UIApplication,
1009 identifier: Option<&NSString>,
1010 notification: &UILocalNotification,
1011 completion_handler: &block2::Block<dyn Fn()>,
1012 );
1013
1014 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1015 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1016 #[optional]
1017 #[unsafe(method(application:handleActionWithIdentifier:forRemoteNotification:withResponseInfo:completionHandler:))]
1018 #[unsafe(method_family = none)]
1019 unsafe fn application_handleActionWithIdentifier_forRemoteNotification_withResponseInfo_completionHandler(
1020 &self,
1021 application: &UIApplication,
1022 identifier: Option<&NSString>,
1023 user_info: &NSDictionary,
1024 response_info: &NSDictionary,
1025 completion_handler: &block2::Block<dyn Fn()>,
1026 );
1027
1028 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1029 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1030 #[optional]
1031 #[unsafe(method(application:handleActionWithIdentifier:forRemoteNotification:completionHandler:))]
1032 #[unsafe(method_family = none)]
1033 unsafe fn application_handleActionWithIdentifier_forRemoteNotification_completionHandler(
1034 &self,
1035 application: &UIApplication,
1036 identifier: Option<&NSString>,
1037 user_info: &NSDictionary,
1038 completion_handler: &block2::Block<dyn Fn()>,
1039 );
1040
1041 #[cfg(all(
1042 feature = "UILocalNotification",
1043 feature = "UIResponder",
1044 feature = "block2"
1045 ))]
1046 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1047 #[optional]
1048 #[unsafe(method(application:handleActionWithIdentifier:forLocalNotification:withResponseInfo:completionHandler:))]
1049 #[unsafe(method_family = none)]
1050 unsafe fn application_handleActionWithIdentifier_forLocalNotification_withResponseInfo_completionHandler(
1051 &self,
1052 application: &UIApplication,
1053 identifier: Option<&NSString>,
1054 notification: &UILocalNotification,
1055 response_info: &NSDictionary,
1056 completion_handler: &block2::Block<dyn Fn()>,
1057 );
1058
1059 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1060 #[optional]
1064 #[unsafe(method(application:didReceiveRemoteNotification:fetchCompletionHandler:))]
1065 #[unsafe(method_family = none)]
1066 unsafe fn application_didReceiveRemoteNotification_fetchCompletionHandler(
1067 &self,
1068 application: &UIApplication,
1069 user_info: &NSDictionary,
1070 completion_handler: &block2::Block<dyn Fn(UIBackgroundFetchResult)>,
1071 );
1072
1073 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1074 #[deprecated = "Use a BGAppRefreshTask in the BackgroundTasks framework instead"]
1076 #[optional]
1077 #[unsafe(method(application:performFetchWithCompletionHandler:))]
1078 #[unsafe(method_family = none)]
1079 unsafe fn application_performFetchWithCompletionHandler(
1080 &self,
1081 application: &UIApplication,
1082 completion_handler: &block2::Block<dyn Fn(UIBackgroundFetchResult)>,
1083 );
1084
1085 #[cfg(all(
1086 feature = "UIApplicationShortcutItem",
1087 feature = "UIResponder",
1088 feature = "block2"
1089 ))]
1090 #[optional]
1091 #[unsafe(method(application:performActionForShortcutItem:completionHandler:))]
1092 #[unsafe(method_family = none)]
1093 unsafe fn application_performActionForShortcutItem_completionHandler(
1094 &self,
1095 application: &UIApplication,
1096 shortcut_item: &UIApplicationShortcutItem,
1097 completion_handler: &block2::Block<dyn Fn(Bool)>,
1098 );
1099
1100 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1101 #[optional]
1102 #[unsafe(method(application:handleEventsForBackgroundURLSession:completionHandler:))]
1103 #[unsafe(method_family = none)]
1104 unsafe fn application_handleEventsForBackgroundURLSession_completionHandler(
1105 &self,
1106 application: &UIApplication,
1107 identifier: &NSString,
1108 completion_handler: &block2::Block<dyn Fn()>,
1109 );
1110
1111 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1112 #[optional]
1113 #[unsafe(method(application:handleWatchKitExtensionRequest:reply:))]
1114 #[unsafe(method_family = none)]
1115 unsafe fn application_handleWatchKitExtensionRequest_reply(
1116 &self,
1117 application: &UIApplication,
1118 user_info: Option<&NSDictionary>,
1119 reply: &block2::Block<dyn Fn(*mut NSDictionary)>,
1120 );
1121
1122 #[cfg(feature = "UIResponder")]
1123 #[optional]
1124 #[unsafe(method(applicationShouldRequestHealthAuthorization:))]
1125 #[unsafe(method_family = none)]
1126 unsafe fn applicationShouldRequestHealthAuthorization(&self, application: &UIApplication);
1127
1128 #[cfg(feature = "UIResponder")]
1129 #[optional]
1130 #[unsafe(method(applicationDidEnterBackground:))]
1131 #[unsafe(method_family = none)]
1132 unsafe fn applicationDidEnterBackground(&self, application: &UIApplication);
1133
1134 #[cfg(feature = "UIResponder")]
1135 #[optional]
1136 #[unsafe(method(applicationWillEnterForeground:))]
1137 #[unsafe(method_family = none)]
1138 unsafe fn applicationWillEnterForeground(&self, application: &UIApplication);
1139
1140 #[cfg(feature = "UIResponder")]
1141 #[optional]
1142 #[unsafe(method(applicationProtectedDataWillBecomeUnavailable:))]
1143 #[unsafe(method_family = none)]
1144 unsafe fn applicationProtectedDataWillBecomeUnavailable(&self, application: &UIApplication);
1145
1146 #[cfg(feature = "UIResponder")]
1147 #[optional]
1148 #[unsafe(method(applicationProtectedDataDidBecomeAvailable:))]
1149 #[unsafe(method_family = none)]
1150 unsafe fn applicationProtectedDataDidBecomeAvailable(&self, application: &UIApplication);
1151
1152 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
1153 #[optional]
1154 #[unsafe(method(window))]
1155 #[unsafe(method_family = none)]
1156 unsafe fn window(&self) -> Option<Retained<UIWindow>>;
1157
1158 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
1159 #[optional]
1161 #[unsafe(method(setWindow:))]
1162 #[unsafe(method_family = none)]
1163 unsafe fn setWindow(&self, window: Option<&UIWindow>);
1164
1165 #[cfg(all(
1166 feature = "UIOrientation",
1167 feature = "UIResponder",
1168 feature = "UIView",
1169 feature = "UIWindow"
1170 ))]
1171 #[optional]
1172 #[unsafe(method(application:supportedInterfaceOrientationsForWindow:))]
1173 #[unsafe(method_family = none)]
1174 unsafe fn application_supportedInterfaceOrientationsForWindow(
1175 &self,
1176 application: &UIApplication,
1177 window: Option<&UIWindow>,
1178 ) -> UIInterfaceOrientationMask;
1179
1180 #[cfg(feature = "UIResponder")]
1181 #[optional]
1182 #[unsafe(method(application:shouldAllowExtensionPointIdentifier:))]
1183 #[unsafe(method_family = none)]
1184 unsafe fn application_shouldAllowExtensionPointIdentifier(
1185 &self,
1186 application: &UIApplication,
1187 extension_point_identifier: &UIApplicationExtensionPointIdentifier,
1188 ) -> bool;
1189
1190 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
1191 #[optional]
1192 #[unsafe(method(application:viewControllerWithRestorationIdentifierPath:coder:))]
1193 #[unsafe(method_family = none)]
1194 unsafe fn application_viewControllerWithRestorationIdentifierPath_coder(
1195 &self,
1196 application: &UIApplication,
1197 identifier_components: &NSArray<NSString>,
1198 coder: &NSCoder,
1199 ) -> Option<Retained<UIViewController>>;
1200
1201 #[cfg(feature = "UIResponder")]
1202 #[optional]
1203 #[unsafe(method(application:shouldSaveSecureApplicationState:))]
1204 #[unsafe(method_family = none)]
1205 unsafe fn application_shouldSaveSecureApplicationState(
1206 &self,
1207 application: &UIApplication,
1208 coder: &NSCoder,
1209 ) -> bool;
1210
1211 #[cfg(feature = "UIResponder")]
1212 #[optional]
1213 #[unsafe(method(application:shouldRestoreSecureApplicationState:))]
1214 #[unsafe(method_family = none)]
1215 unsafe fn application_shouldRestoreSecureApplicationState(
1216 &self,
1217 application: &UIApplication,
1218 coder: &NSCoder,
1219 ) -> bool;
1220
1221 #[cfg(feature = "UIResponder")]
1222 #[optional]
1223 #[unsafe(method(application:willEncodeRestorableStateWithCoder:))]
1224 #[unsafe(method_family = none)]
1225 unsafe fn application_willEncodeRestorableStateWithCoder(
1226 &self,
1227 application: &UIApplication,
1228 coder: &NSCoder,
1229 );
1230
1231 #[cfg(feature = "UIResponder")]
1232 #[optional]
1233 #[unsafe(method(application:didDecodeRestorableStateWithCoder:))]
1234 #[unsafe(method_family = none)]
1235 unsafe fn application_didDecodeRestorableStateWithCoder(
1236 &self,
1237 application: &UIApplication,
1238 coder: &NSCoder,
1239 );
1240
1241 #[cfg(feature = "UIResponder")]
1242 #[deprecated = "Use application:shouldSaveSecureApplicationState: instead"]
1243 #[optional]
1244 #[unsafe(method(application:shouldSaveApplicationState:))]
1245 #[unsafe(method_family = none)]
1246 unsafe fn application_shouldSaveApplicationState(
1247 &self,
1248 application: &UIApplication,
1249 coder: &NSCoder,
1250 ) -> bool;
1251
1252 #[cfg(feature = "UIResponder")]
1253 #[deprecated = "Use application:shouldRestoreSecureApplicationState: instead"]
1254 #[optional]
1255 #[unsafe(method(application:shouldRestoreApplicationState:))]
1256 #[unsafe(method_family = none)]
1257 unsafe fn application_shouldRestoreApplicationState(
1258 &self,
1259 application: &UIApplication,
1260 coder: &NSCoder,
1261 ) -> bool;
1262
1263 #[cfg(feature = "UIResponder")]
1264 #[optional]
1265 #[unsafe(method(application:willContinueUserActivityWithType:))]
1266 #[unsafe(method_family = none)]
1267 unsafe fn application_willContinueUserActivityWithType(
1268 &self,
1269 application: &UIApplication,
1270 user_activity_type: &NSString,
1271 ) -> bool;
1272
1273 #[cfg(all(
1274 feature = "UIResponder",
1275 feature = "UIUserActivity",
1276 feature = "block2"
1277 ))]
1278 #[optional]
1279 #[unsafe(method(application:continueUserActivity:restorationHandler:))]
1280 #[unsafe(method_family = none)]
1281 unsafe fn application_continueUserActivity_restorationHandler(
1282 &self,
1283 application: &UIApplication,
1284 user_activity: &NSUserActivity,
1285 restoration_handler: &block2::Block<
1286 dyn Fn(*mut NSArray<ProtocolObject<dyn UIUserActivityRestoring>>),
1287 >,
1288 ) -> bool;
1289
1290 #[cfg(feature = "UIResponder")]
1291 #[optional]
1292 #[unsafe(method(application:didFailToContinueUserActivityWithType:error:))]
1293 #[unsafe(method_family = none)]
1294 unsafe fn application_didFailToContinueUserActivityWithType_error(
1295 &self,
1296 application: &UIApplication,
1297 user_activity_type: &NSString,
1298 error: &NSError,
1299 );
1300
1301 #[cfg(feature = "UIResponder")]
1302 #[optional]
1303 #[unsafe(method(application:didUpdateUserActivity:))]
1304 #[unsafe(method_family = none)]
1305 unsafe fn application_didUpdateUserActivity(
1306 &self,
1307 application: &UIApplication,
1308 user_activity: &NSUserActivity,
1309 );
1310
1311 #[cfg(all(feature = "UIResponder", feature = "objc2-cloud-kit"))]
1312 #[optional]
1313 #[unsafe(method(application:userDidAcceptCloudKitShareWithMetadata:))]
1314 #[unsafe(method_family = none)]
1315 unsafe fn application_userDidAcceptCloudKitShareWithMetadata(
1316 &self,
1317 application: &UIApplication,
1318 cloud_kit_share_metadata: &CKShareMetadata,
1319 );
1320
1321 #[cfg(all(
1322 feature = "UIResponder",
1323 feature = "UISceneOptions",
1324 feature = "UISceneSession"
1325 ))]
1326 #[optional]
1327 #[unsafe(method(application:configurationForConnectingSceneSession:options:))]
1328 #[unsafe(method_family = none)]
1329 unsafe fn application_configurationForConnectingSceneSession_options(
1330 &self,
1331 application: &UIApplication,
1332 connecting_scene_session: &UISceneSession,
1333 options: &UISceneConnectionOptions,
1334 ) -> Retained<UISceneConfiguration>;
1335
1336 #[cfg(all(feature = "UIResponder", feature = "UISceneSession"))]
1337 #[optional]
1338 #[unsafe(method(application:didDiscardSceneSessions:))]
1339 #[unsafe(method_family = none)]
1340 unsafe fn application_didDiscardSceneSessions(
1341 &self,
1342 application: &UIApplication,
1343 scene_sessions: &NSSet<UISceneSession>,
1344 );
1345
1346 #[cfg(feature = "UIResponder")]
1347 #[optional]
1348 #[unsafe(method(applicationShouldAutomaticallyLocalizeKeyCommands:))]
1349 #[unsafe(method_family = none)]
1350 unsafe fn applicationShouldAutomaticallyLocalizeKeyCommands(
1351 &self,
1352 application: &UIApplication,
1353 ) -> bool;
1354 }
1355);
1356
1357#[cfg(feature = "UIResponder")]
1359impl UIApplication {
1360 extern_methods!(
1361 #[deprecated]
1362 #[unsafe(method(isProximitySensingEnabled))]
1363 #[unsafe(method_family = none)]
1364 pub unsafe fn isProximitySensingEnabled(&self) -> bool;
1365
1366 #[deprecated]
1368 #[unsafe(method(setProximitySensingEnabled:))]
1369 #[unsafe(method_family = none)]
1370 pub unsafe fn setProximitySensingEnabled(&self, proximity_sensing_enabled: bool);
1371
1372 #[deprecated = "Use -[UIViewController prefersStatusBarHidden]"]
1373 #[unsafe(method(setStatusBarHidden:animated:))]
1374 #[unsafe(method_family = none)]
1375 pub unsafe fn setStatusBarHidden_animated(&self, hidden: bool, animated: bool);
1376
1377 #[cfg(feature = "UIOrientation")]
1378 #[deprecated = "Explicit setting of the status bar orientation is more limited in iOS 6.0 and later"]
1380 #[unsafe(method(setStatusBarOrientation:))]
1381 #[unsafe(method_family = none)]
1382 pub unsafe fn setStatusBarOrientation(
1383 &self,
1384 status_bar_orientation: UIInterfaceOrientation,
1385 );
1386
1387 #[cfg(feature = "UIOrientation")]
1388 #[deprecated = "Explicit setting of the status bar orientation is more limited in iOS 6.0 and later"]
1389 #[unsafe(method(setStatusBarOrientation:animated:))]
1390 #[unsafe(method_family = none)]
1391 pub unsafe fn setStatusBarOrientation_animated(
1392 &self,
1393 interface_orientation: UIInterfaceOrientation,
1394 animated: bool,
1395 );
1396
1397 #[deprecated = "Use -[UIViewController preferredStatusBarStyle]"]
1399 #[unsafe(method(setStatusBarStyle:))]
1400 #[unsafe(method_family = none)]
1401 pub unsafe fn setStatusBarStyle(&self, status_bar_style: UIStatusBarStyle);
1402
1403 #[deprecated = "Use -[UIViewController preferredStatusBarStyle]"]
1404 #[unsafe(method(setStatusBarStyle:animated:))]
1405 #[unsafe(method_family = none)]
1406 pub unsafe fn setStatusBarStyle_animated(
1407 &self,
1408 status_bar_style: UIStatusBarStyle,
1409 animated: bool,
1410 );
1411
1412 #[deprecated = "Use -[UIViewController prefersStatusBarHidden]"]
1414 #[unsafe(method(setStatusBarHidden:))]
1415 #[unsafe(method_family = none)]
1416 pub unsafe fn setStatusBarHidden(&self, status_bar_hidden: bool);
1417
1418 #[deprecated = "Use -[UIViewController prefersStatusBarHidden]"]
1419 #[unsafe(method(setStatusBarHidden:withAnimation:))]
1420 #[unsafe(method_family = none)]
1421 pub unsafe fn setStatusBarHidden_withAnimation(
1422 &self,
1423 hidden: bool,
1424 animation: UIStatusBarAnimation,
1425 );
1426
1427 #[cfg(feature = "block2")]
1428 #[deprecated = "Please use PushKit for VoIP applications instead of calling this method"]
1429 #[unsafe(method(setKeepAliveTimeout:handler:))]
1430 #[unsafe(method_family = none)]
1431 pub unsafe fn setKeepAliveTimeout_handler(
1432 &self,
1433 timeout: NSTimeInterval,
1434 keep_alive_handler: Option<&block2::Block<dyn Fn()>>,
1435 ) -> bool;
1436
1437 #[deprecated = "Please use PushKit for VoIP applications instead of calling this method"]
1438 #[unsafe(method(clearKeepAliveTimeout))]
1439 #[unsafe(method_family = none)]
1440 pub unsafe fn clearKeepAliveTimeout(&self);
1441 );
1442}
1443
1444extern "C-unwind" {
1445 pub fn UIApplicationMain(
1446 argc: c_int,
1447 argv: NonNull<*mut c_char>,
1448 principal_class_name: Option<&NSString>,
1449 delegate_class_name: Option<&NSString>,
1450 ) -> c_int;
1451}
1452
1453extern "C" {
1454 pub static UITrackingRunLoopMode: &'static NSRunLoopMode;
1456}
1457
1458extern "C" {
1459 pub static UIApplicationDidEnterBackgroundNotification: &'static NSNotificationName;
1461}
1462
1463extern "C" {
1464 pub static UIApplicationWillEnterForegroundNotification: &'static NSNotificationName;
1466}
1467
1468extern "C" {
1469 pub static UIApplicationDidFinishLaunchingNotification: &'static NSNotificationName;
1471}
1472
1473extern "C" {
1474 pub static UIApplicationDidBecomeActiveNotification: &'static NSNotificationName;
1476}
1477
1478extern "C" {
1479 pub static UIApplicationWillResignActiveNotification: &'static NSNotificationName;
1481}
1482
1483extern "C" {
1484 pub static UIApplicationDidReceiveMemoryWarningNotification: &'static NSNotificationName;
1486}
1487
1488extern "C" {
1489 pub static UIApplicationWillTerminateNotification: &'static NSNotificationName;
1491}
1492
1493extern "C" {
1494 pub static UIApplicationSignificantTimeChangeNotification: &'static NSNotificationName;
1496}
1497
1498extern "C" {
1499 pub static UIApplicationWillChangeStatusBarOrientationNotification: &'static NSNotificationName;
1501}
1502
1503extern "C" {
1504 pub static UIApplicationDidChangeStatusBarOrientationNotification: &'static NSNotificationName;
1506}
1507
1508extern "C" {
1509 pub static UIApplicationStatusBarOrientationUserInfoKey: &'static NSString;
1511}
1512
1513extern "C" {
1514 pub static UIApplicationWillChangeStatusBarFrameNotification: &'static NSNotificationName;
1516}
1517
1518extern "C" {
1519 pub static UIApplicationDidChangeStatusBarFrameNotification: &'static NSNotificationName;
1521}
1522
1523extern "C" {
1524 pub static UIApplicationStatusBarFrameUserInfoKey: &'static NSString;
1526}
1527
1528extern "C" {
1529 pub static UIApplicationBackgroundRefreshStatusDidChangeNotification:
1531 &'static NSNotificationName;
1532}
1533
1534extern "C" {
1535 pub static UIApplicationProtectedDataWillBecomeUnavailable: &'static NSNotificationName;
1537}
1538
1539extern "C" {
1540 pub static UIApplicationProtectedDataDidBecomeAvailable: &'static NSNotificationName;
1542}
1543
1544extern "C" {
1545 pub static UIApplicationLaunchOptionsURLKey: &'static UIApplicationLaunchOptionsKey;
1547}
1548
1549extern "C" {
1550 pub static UIApplicationLaunchOptionsSourceApplicationKey:
1552 &'static UIApplicationLaunchOptionsKey;
1553}
1554
1555extern "C" {
1556 pub static UIApplicationLaunchOptionsRemoteNotificationKey:
1558 &'static UIApplicationLaunchOptionsKey;
1559}
1560
1561extern "C" {
1562 pub static UIApplicationLaunchOptionsLocalNotificationKey:
1564 &'static UIApplicationLaunchOptionsKey;
1565}
1566
1567extern "C" {
1568 pub static UIApplicationLaunchOptionsAnnotationKey: &'static UIApplicationLaunchOptionsKey;
1570}
1571
1572extern "C" {
1573 pub static UIApplicationLaunchOptionsLocationKey: &'static UIApplicationLaunchOptionsKey;
1575}
1576
1577extern "C" {
1578 pub static UIApplicationLaunchOptionsNewsstandDownloadsKey:
1580 &'static UIApplicationLaunchOptionsKey;
1581}
1582
1583extern "C" {
1584 pub static UIApplicationLaunchOptionsBluetoothCentralsKey:
1586 &'static UIApplicationLaunchOptionsKey;
1587}
1588
1589extern "C" {
1590 pub static UIApplicationLaunchOptionsBluetoothPeripheralsKey:
1592 &'static UIApplicationLaunchOptionsKey;
1593}
1594
1595extern "C" {
1596 pub static UIApplicationLaunchOptionsShortcutItemKey: &'static UIApplicationLaunchOptionsKey;
1598}
1599
1600extern "C" {
1601 pub static UIApplicationLaunchOptionsEventAttributionKey:
1603 &'static UIApplicationLaunchOptionsKey;
1604}
1605
1606extern "C" {
1607 pub static UIApplicationLaunchOptionsUserActivityDictionaryKey:
1609 &'static UIApplicationLaunchOptionsKey;
1610}
1611
1612extern "C" {
1613 pub static UIApplicationLaunchOptionsUserActivityTypeKey:
1615 &'static UIApplicationLaunchOptionsKey;
1616}
1617
1618extern "C" {
1619 pub static UIApplicationLaunchOptionsCloudKitShareMetadataKey:
1621 &'static UIApplicationLaunchOptionsKey;
1622}
1623
1624extern "C" {
1625 pub static UIApplicationOpenSettingsURLString: &'static NSString;
1627}
1628
1629extern "C" {
1630 pub static UIApplicationOpenDefaultApplicationsSettingsURLString: &'static NSString;
1634}
1635
1636extern "C" {
1637 pub static UIApplicationOpenNotificationSettingsURLString: &'static NSString;
1639}
1640
1641extern "C" {
1642 pub static UIApplicationOpenURLOptionsSourceApplicationKey:
1644 &'static UIApplicationOpenURLOptionsKey;
1645}
1646
1647extern "C" {
1648 pub static UIApplicationOpenURLOptionsAnnotationKey: &'static UIApplicationOpenURLOptionsKey;
1650}
1651
1652extern "C" {
1653 pub static UIApplicationOpenURLOptionsOpenInPlaceKey: &'static UIApplicationOpenURLOptionsKey;
1655}
1656
1657extern "C" {
1658 pub static UIApplicationOpenURLOptionsEventAttributionKey:
1660 &'static UIApplicationOpenURLOptionsKey;
1661}
1662
1663extern "C" {
1664 pub static UIApplicationUserDidTakeScreenshotNotification: &'static NSNotificationName;
1666}
1667
1668extern "C" {
1669 pub static UIApplicationKeyboardExtensionPointIdentifier:
1671 &'static UIApplicationExtensionPointIdentifier;
1672}
1673
1674extern "C" {
1675 pub static UIApplicationOpenURLOptionUniversalLinksOnly:
1677 &'static UIApplicationOpenExternalURLOptionsKey;
1678}
1679
1680extern "C" {
1681 pub static UIApplicationOpenExternalURLOptionsEventAttributionKey:
1683 &'static UIApplicationOpenExternalURLOptionsKey;
1684}