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 #[doc(alias = "UIStatusBarStyleBlackTranslucent")]
27 #[deprecated]
28 pub const BlackTranslucent: Self = Self(1);
29 #[doc(alias = "UIStatusBarStyleBlackOpaque")]
30 #[deprecated]
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 #[doc(alias = "UIRemoteNotificationTypeNone")]
78#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
79 const None = 0;
80 #[doc(alias = "UIRemoteNotificationTypeBadge")]
81#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
82 const Badge = 1<<0;
83 #[doc(alias = "UIRemoteNotificationTypeSound")]
84#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
85 const Sound = 1<<1;
86 #[doc(alias = "UIRemoteNotificationTypeAlert")]
87#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
88 const Alert = 1<<2;
89 #[doc(alias = "UIRemoteNotificationTypeNewsstandContentAvailability")]
90#[deprecated = "Use UserNotifications Framework's UNAuthorizationOptions for user notifications and registerForRemoteNotifications for receiving remote notifications instead."]
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 #[deprecated = "Please use PushKit for VoIP applications."]
181 pub static UIMinimumKeepAliveTimeout: NSTimeInterval;
182}
183
184extern "C" {
185 pub static UIApplicationBackgroundFetchIntervalMinimum: NSTimeInterval;
187}
188
189extern "C" {
190 pub static UIApplicationBackgroundFetchIntervalNever: NSTimeInterval;
192}
193
194pub type UIApplicationOpenExternalURLOptionsKey = NSString;
197
198extern_class!(
199 #[unsafe(super(UIResponder, NSObject))]
201 #[thread_kind = MainThreadOnly]
202 #[derive(Debug, PartialEq, Eq, Hash)]
203 #[cfg(feature = "UIResponder")]
204 pub struct UIApplication;
205);
206
207#[cfg(feature = "UIResponder")]
208extern_conformance!(
209 unsafe impl NSObjectProtocol for UIApplication {}
210);
211
212#[cfg(feature = "UIResponder")]
213extern_conformance!(
214 unsafe impl UIResponderStandardEditActions for UIApplication {}
215);
216
217#[cfg(feature = "UIResponder")]
218impl UIApplication {
219 extern_methods!(
220 #[unsafe(method(sharedApplication))]
221 #[unsafe(method_family = none)]
222 pub fn sharedApplication(mtm: MainThreadMarker) -> Retained<UIApplication>;
223
224 #[unsafe(method(delegate))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn delegate(
230 &self,
231 ) -> Option<Retained<ProtocolObject<dyn UIApplicationDelegate>>>;
232
233 #[unsafe(method(setDelegate:))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn setDelegate(
241 &self,
242 delegate: Option<&ProtocolObject<dyn UIApplicationDelegate>>,
243 );
244
245 #[deprecated = "Use UIView's userInteractionEnabled property instead"]
246 #[unsafe(method(beginIgnoringInteractionEvents))]
247 #[unsafe(method_family = none)]
248 pub fn beginIgnoringInteractionEvents(&self);
249
250 #[deprecated = "Use UIView's userInteractionEnabled property instead"]
251 #[unsafe(method(endIgnoringInteractionEvents))]
252 #[unsafe(method_family = none)]
253 pub fn endIgnoringInteractionEvents(&self);
254
255 #[deprecated = "Use UIView's userInteractionEnabled property instead"]
256 #[unsafe(method(isIgnoringInteractionEvents))]
257 #[unsafe(method_family = none)]
258 pub fn isIgnoringInteractionEvents(&self) -> bool;
259
260 #[unsafe(method(isIdleTimerDisabled))]
261 #[unsafe(method_family = none)]
262 pub fn isIdleTimerDisabled(&self) -> bool;
263
264 #[unsafe(method(setIdleTimerDisabled:))]
266 #[unsafe(method_family = none)]
267 pub fn setIdleTimerDisabled(&self, idle_timer_disabled: bool);
268
269 #[deprecated]
270 #[unsafe(method(openURL:))]
271 #[unsafe(method_family = none)]
272 pub fn openURL(&self, url: &NSURL) -> bool;
273
274 #[unsafe(method(canOpenURL:))]
275 #[unsafe(method_family = none)]
276 pub fn canOpenURL(&self, url: &NSURL) -> bool;
277
278 #[cfg(feature = "block2")]
279 #[unsafe(method(openURL:options:completionHandler:))]
283 #[unsafe(method_family = none)]
284 pub unsafe fn openURL_options_completionHandler(
285 &self,
286 url: &NSURL,
287 options: &NSDictionary<UIApplicationOpenExternalURLOptionsKey, AnyObject>,
288 completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
289 );
290
291 #[cfg(feature = "UIEvent")]
292 #[unsafe(method(sendEvent:))]
293 #[unsafe(method_family = none)]
294 pub fn sendEvent(&self, event: &UIEvent);
295
296 #[cfg(all(feature = "UIView", feature = "UIWindow"))]
297 #[deprecated = "Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes"]
298 #[unsafe(method(keyWindow))]
299 #[unsafe(method_family = none)]
300 pub fn keyWindow(&self) -> Option<Retained<UIWindow>>;
301
302 #[cfg(all(feature = "UIView", feature = "UIWindow"))]
303 #[deprecated = "Use UIWindowScene.windows on a relevant window scene instead"]
304 #[unsafe(method(windows))]
305 #[unsafe(method_family = none)]
306 pub fn windows(&self) -> Retained<NSArray<UIWindow>>;
307
308 #[cfg(feature = "UIEvent")]
309 #[unsafe(method(sendAction:to:from:forEvent:))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn sendAction_to_from_forEvent(
317 &self,
318 action: Sel,
319 target: Option<&AnyObject>,
320 sender: Option<&AnyObject>,
321 event: Option<&UIEvent>,
322 ) -> bool;
323
324 #[deprecated = "Provide a custom network activity UI in your app if desired."]
325 #[unsafe(method(isNetworkActivityIndicatorVisible))]
326 #[unsafe(method_family = none)]
327 pub fn isNetworkActivityIndicatorVisible(&self) -> bool;
328
329 #[deprecated = "Provide a custom network activity UI in your app if desired."]
331 #[unsafe(method(setNetworkActivityIndicatorVisible:))]
332 #[unsafe(method_family = none)]
333 pub fn setNetworkActivityIndicatorVisible(&self, network_activity_indicator_visible: bool);
334
335 #[cfg(all(feature = "UIOrientation", feature = "UIView", feature = "UIWindow"))]
336 #[unsafe(method(supportedInterfaceOrientationsForWindow:))]
337 #[unsafe(method_family = none)]
338 pub fn supportedInterfaceOrientationsForWindow(
339 &self,
340 window: Option<&UIWindow>,
341 ) -> UIInterfaceOrientationMask;
342
343 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
344 #[unsafe(method(statusBarOrientationAnimationDuration))]
345 #[unsafe(method_family = none)]
346 pub fn statusBarOrientationAnimationDuration(&self) -> NSTimeInterval;
347
348 #[cfg(feature = "objc2-core-foundation")]
349 #[deprecated = "Use the statusBarManager property of the window scene instead."]
350 #[unsafe(method(statusBarFrame))]
351 #[unsafe(method_family = none)]
352 pub fn statusBarFrame(&self) -> CGRect;
353
354 #[deprecated = "Use -[UNUserNotificationCenter setBadgeCount:withCompletionHandler:] instead."]
355 #[unsafe(method(applicationIconBadgeNumber))]
356 #[unsafe(method_family = none)]
357 pub fn applicationIconBadgeNumber(&self) -> NSInteger;
358
359 #[deprecated = "Use -[UNUserNotificationCenter setBadgeCount:withCompletionHandler:] instead."]
361 #[unsafe(method(setApplicationIconBadgeNumber:))]
362 #[unsafe(method_family = none)]
363 pub fn setApplicationIconBadgeNumber(&self, application_icon_badge_number: NSInteger);
364
365 #[unsafe(method(applicationSupportsShakeToEdit))]
366 #[unsafe(method_family = none)]
367 pub fn applicationSupportsShakeToEdit(&self) -> bool;
368
369 #[unsafe(method(setApplicationSupportsShakeToEdit:))]
371 #[unsafe(method_family = none)]
372 pub fn setApplicationSupportsShakeToEdit(&self, application_supports_shake_to_edit: bool);
373
374 #[unsafe(method(applicationState))]
375 #[unsafe(method_family = none)]
376 pub fn applicationState(&self) -> UIApplicationState;
377
378 #[unsafe(method(backgroundTimeRemaining))]
379 #[unsafe(method_family = none)]
380 pub fn backgroundTimeRemaining(&self) -> NSTimeInterval;
381
382 #[cfg(feature = "block2")]
383 #[unsafe(method(beginBackgroundTaskWithExpirationHandler:))]
384 #[unsafe(method_family = none)]
385 pub fn beginBackgroundTaskWithExpirationHandler(
386 &self,
387 handler: Option<&block2::DynBlock<dyn Fn()>>,
388 ) -> UIBackgroundTaskIdentifier;
389
390 #[cfg(feature = "block2")]
391 #[unsafe(method(beginBackgroundTaskWithName:expirationHandler:))]
392 #[unsafe(method_family = none)]
393 pub fn beginBackgroundTaskWithName_expirationHandler(
394 &self,
395 task_name: Option<&NSString>,
396 handler: Option<&block2::DynBlock<dyn Fn()>>,
397 ) -> UIBackgroundTaskIdentifier;
398
399 #[unsafe(method(endBackgroundTask:))]
400 #[unsafe(method_family = none)]
401 pub fn endBackgroundTask(&self, identifier: UIBackgroundTaskIdentifier);
402
403 #[deprecated = "Use a BGAppRefreshTask in the BackgroundTasks framework instead"]
412 #[unsafe(method(setMinimumBackgroundFetchInterval:))]
413 #[unsafe(method_family = none)]
414 pub fn setMinimumBackgroundFetchInterval(
415 &self,
416 minimum_background_fetch_interval: NSTimeInterval,
417 );
418
419 #[unsafe(method(backgroundRefreshStatus))]
423 #[unsafe(method_family = none)]
424 pub fn backgroundRefreshStatus(&self) -> UIBackgroundRefreshStatus;
425
426 #[unsafe(method(isProtectedDataAvailable))]
427 #[unsafe(method_family = none)]
428 pub fn isProtectedDataAvailable(&self) -> bool;
429
430 #[cfg(feature = "UIInterface")]
431 #[unsafe(method(userInterfaceLayoutDirection))]
432 #[unsafe(method_family = none)]
433 pub fn userInterfaceLayoutDirection(&self) -> UIUserInterfaceLayoutDirection;
434
435 #[cfg(feature = "UIContentSizeCategory")]
436 #[unsafe(method(preferredContentSizeCategory))]
437 #[unsafe(method_family = none)]
438 pub fn preferredContentSizeCategory(&self) -> Retained<UIContentSizeCategory>;
439
440 #[cfg(feature = "UIScene")]
441 #[unsafe(method(connectedScenes))]
442 #[unsafe(method_family = none)]
443 pub fn connectedScenes(&self) -> Retained<NSSet<UIScene>>;
444
445 #[cfg(feature = "UISceneSession")]
446 #[unsafe(method(openSessions))]
447 #[unsafe(method_family = none)]
448 pub fn openSessions(&self) -> Retained<NSSet<UISceneSession>>;
449
450 #[unsafe(method(supportsMultipleScenes))]
451 #[unsafe(method_family = none)]
452 pub fn supportsMultipleScenes(&self) -> bool;
453
454 #[cfg(all(feature = "UISceneSessionActivationRequest", feature = "block2"))]
455 #[unsafe(method(activateSceneSessionForRequest:errorHandler:))]
460 #[unsafe(method_family = none)]
461 pub fn activateSceneSessionForRequest_errorHandler(
462 &self,
463 request: &UISceneSessionActivationRequest,
464 error_handler: Option<&block2::DynBlock<dyn Fn(NonNull<NSError>)>>,
465 );
466
467 #[cfg(all(
468 feature = "UISceneOptions",
469 feature = "UISceneSession",
470 feature = "block2"
471 ))]
472 #[deprecated = "Please use activateSceneSessionForRequest:errorHandler:"]
473 #[unsafe(method(requestSceneSessionActivation:userActivity:options:errorHandler:))]
474 #[unsafe(method_family = none)]
475 pub fn requestSceneSessionActivation_userActivity_options_errorHandler(
476 &self,
477 scene_session: Option<&UISceneSession>,
478 user_activity: Option<&NSUserActivity>,
479 options: Option<&UISceneActivationRequestOptions>,
480 error_handler: Option<&block2::DynBlock<dyn Fn(NonNull<NSError>)>>,
481 );
482
483 #[cfg(all(
484 feature = "UISceneOptions",
485 feature = "UISceneSession",
486 feature = "block2"
487 ))]
488 #[unsafe(method(requestSceneSessionDestruction:options:errorHandler:))]
489 #[unsafe(method_family = none)]
490 pub fn requestSceneSessionDestruction_options_errorHandler(
491 &self,
492 scene_session: &UISceneSession,
493 options: Option<&UISceneDestructionRequestOptions>,
494 error_handler: Option<&block2::DynBlock<dyn Fn(NonNull<NSError>)>>,
495 );
496
497 #[cfg(feature = "UISceneSession")]
498 #[unsafe(method(requestSceneSessionRefresh:))]
499 #[unsafe(method_family = none)]
500 pub fn requestSceneSessionRefresh(&self, scene_session: &UISceneSession);
501 );
502}
503
504#[cfg(feature = "UIResponder")]
506impl UIApplication {
507 extern_methods!(
508 #[unsafe(method(init))]
509 #[unsafe(method_family = init)]
510 pub fn init(this: Allocated<Self>) -> Retained<Self>;
511
512 #[unsafe(method(new))]
513 #[unsafe(method_family = new)]
514 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
515 );
516}
517
518#[cfg(feature = "UIResponder")]
520impl UIApplication {
521 extern_methods!(
522 #[unsafe(method(registerForRemoteNotifications))]
523 #[unsafe(method_family = none)]
524 pub fn registerForRemoteNotifications(&self);
525
526 #[unsafe(method(unregisterForRemoteNotifications))]
527 #[unsafe(method_family = none)]
528 pub fn unregisterForRemoteNotifications(&self);
529
530 #[unsafe(method(isRegisteredForRemoteNotifications))]
531 #[unsafe(method_family = none)]
532 pub fn isRegisteredForRemoteNotifications(&self) -> bool;
533
534 #[deprecated = "Use -[UIApplication registerForRemoteNotifications] and UserNotifications Framework's -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:]"]
535 #[unsafe(method(registerForRemoteNotificationTypes:))]
536 #[unsafe(method_family = none)]
537 pub fn registerForRemoteNotificationTypes(&self, types: UIRemoteNotificationType);
538
539 #[deprecated = "Use -[UIApplication isRegisteredForRemoteNotifications] and UserNotifications Framework's -[UNUserNotificationCenter getNotificationSettingsWithCompletionHandler:] to retrieve user-enabled remote notification and user notification settings"]
540 #[unsafe(method(enabledRemoteNotificationTypes))]
541 #[unsafe(method_family = none)]
542 pub fn enabledRemoteNotificationTypes(&self) -> UIRemoteNotificationType;
543 );
544}
545
546#[cfg(feature = "UIResponder")]
548impl UIApplication {
549 extern_methods!(
550 #[cfg(feature = "UILocalNotification")]
551 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter addNotificationRequest:withCompletionHandler:]"]
552 #[unsafe(method(presentLocalNotificationNow:))]
553 #[unsafe(method_family = none)]
554 pub fn presentLocalNotificationNow(&self, notification: &UILocalNotification);
555
556 #[cfg(feature = "UILocalNotification")]
557 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter addNotificationRequest:withCompletionHandler:]"]
558 #[unsafe(method(scheduleLocalNotification:))]
559 #[unsafe(method_family = none)]
560 pub fn scheduleLocalNotification(&self, notification: &UILocalNotification);
561
562 #[cfg(feature = "UILocalNotification")]
563 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter removePendingNotificationRequestsWithIdentifiers:]"]
564 #[unsafe(method(cancelLocalNotification:))]
565 #[unsafe(method_family = none)]
566 pub fn cancelLocalNotification(&self, notification: &UILocalNotification);
567
568 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter removeAllPendingNotificationRequests]"]
569 #[unsafe(method(cancelAllLocalNotifications))]
570 #[unsafe(method_family = none)]
571 pub fn cancelAllLocalNotifications(&self);
572
573 #[cfg(feature = "UILocalNotification")]
574 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter getPendingNotificationRequestsWithCompletionHandler:]"]
575 #[unsafe(method(scheduledLocalNotifications))]
576 #[unsafe(method_family = none)]
577 pub fn scheduledLocalNotifications(&self)
578 -> Option<Retained<NSArray<UILocalNotification>>>;
579
580 #[cfg(feature = "UILocalNotification")]
581 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter getPendingNotificationRequestsWithCompletionHandler:]"]
585 #[unsafe(method(setScheduledLocalNotifications:))]
586 #[unsafe(method_family = none)]
587 pub fn setScheduledLocalNotifications(
588 &self,
589 scheduled_local_notifications: Option<&NSArray<UILocalNotification>>,
590 );
591 );
592}
593
594#[cfg(feature = "UIResponder")]
596impl UIApplication {
597 extern_methods!(
598 #[cfg(feature = "UIUserNotificationSettings")]
599 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:] and -[UNUserNotificationCenter setNotificationCategories:]"]
600 #[unsafe(method(registerUserNotificationSettings:))]
601 #[unsafe(method_family = none)]
602 pub fn registerUserNotificationSettings(
603 &self,
604 notification_settings: &UIUserNotificationSettings,
605 );
606
607 #[cfg(feature = "UIUserNotificationSettings")]
608 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter getNotificationSettingsWithCompletionHandler:] and -[UNUserNotificationCenter getNotificationCategoriesWithCompletionHandler:]"]
609 #[unsafe(method(currentUserNotificationSettings))]
610 #[unsafe(method_family = none)]
611 pub fn currentUserNotificationSettings(
612 &self,
613 ) -> Option<Retained<UIUserNotificationSettings>>;
614 );
615}
616
617#[cfg(feature = "UIResponder")]
619impl UIApplication {
620 extern_methods!(
621 #[unsafe(method(beginReceivingRemoteControlEvents))]
622 #[unsafe(method_family = none)]
623 pub fn beginReceivingRemoteControlEvents(&self);
624
625 #[unsafe(method(endReceivingRemoteControlEvents))]
626 #[unsafe(method_family = none)]
627 pub fn endReceivingRemoteControlEvents(&self);
628 );
629}
630
631#[cfg(feature = "UIResponder")]
633impl UIApplication {
634 extern_methods!(
635 #[cfg(feature = "UIImage")]
636 #[deprecated = "Newsstand apps now behave like normal apps on SpringBoard"]
637 #[unsafe(method(setNewsstandIconImage:))]
638 #[unsafe(method_family = none)]
639 pub fn setNewsstandIconImage(&self, image: Option<&UIImage>);
640 );
641}
642
643#[cfg(feature = "UIResponder")]
645impl UIApplication {
646 extern_methods!(
647 #[cfg(feature = "UIApplicationShortcutItem")]
648 #[unsafe(method(shortcutItems))]
649 #[unsafe(method_family = none)]
650 pub fn shortcutItems(&self) -> Option<Retained<NSArray<UIApplicationShortcutItem>>>;
651
652 #[cfg(feature = "UIApplicationShortcutItem")]
653 #[unsafe(method(setShortcutItems:))]
657 #[unsafe(method_family = none)]
658 pub fn setShortcutItems(&self, shortcut_items: Option<&NSArray<UIApplicationShortcutItem>>);
659 );
660}
661
662#[cfg(feature = "UIResponder")]
664impl UIApplication {
665 extern_methods!(
666 #[unsafe(method(supportsAlternateIcons))]
667 #[unsafe(method_family = none)]
668 pub fn supportsAlternateIcons(&self) -> bool;
669
670 #[cfg(feature = "block2")]
671 #[unsafe(method(setAlternateIconName:completionHandler:))]
672 #[unsafe(method_family = none)]
673 pub fn setAlternateIconName_completionHandler(
674 &self,
675 alternate_icon_name: Option<&NSString>,
676 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
677 );
678
679 #[unsafe(method(alternateIconName))]
680 #[unsafe(method_family = none)]
681 pub fn alternateIconName(&self) -> Option<Retained<NSString>>;
682 );
683}
684
685#[cfg(feature = "UIResponder")]
687impl UIApplication {
688 extern_methods!(
689 #[unsafe(method(extendStateRestoration))]
690 #[unsafe(method_family = none)]
691 pub unsafe fn extendStateRestoration(&self);
692
693 #[unsafe(method(completeStateRestoration))]
694 #[unsafe(method_family = none)]
695 pub unsafe fn completeStateRestoration(&self);
696
697 #[unsafe(method(ignoreSnapshotOnNextApplicationLaunch))]
698 #[unsafe(method_family = none)]
699 pub fn ignoreSnapshotOnNextApplicationLaunch(&self);
700
701 #[cfg(feature = "UIStateRestoration")]
702 #[unsafe(method(registerObjectForStateRestoration:restorationIdentifier:))]
703 #[unsafe(method_family = none)]
704 pub fn registerObjectForStateRestoration_restorationIdentifier(
705 object: &ProtocolObject<dyn UIStateRestoring>,
706 restoration_identifier: &NSString,
707 );
708 );
709}
710
711#[repr(transparent)]
714#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
715pub struct UIApplicationCategory(pub NSInteger);
716impl UIApplicationCategory {
717 #[doc(alias = "UIApplicationCategoryWebBrowser")]
718 pub const WebBrowser: Self = Self(1);
719}
720
721unsafe impl Encode for UIApplicationCategory {
722 const ENCODING: Encoding = NSInteger::ENCODING;
723}
724
725unsafe impl RefEncode for UIApplicationCategory {
726 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
727}
728
729#[repr(transparent)]
734#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
735pub struct UIApplicationCategoryDefaultStatus(pub NSInteger);
736impl UIApplicationCategoryDefaultStatus {
737 #[doc(alias = "UIApplicationCategoryDefaultStatusUnavailable")]
739 pub const Unavailable: Self = Self(0);
740 #[doc(alias = "UIApplicationCategoryDefaultStatusIsDefault")]
742 pub const IsDefault: Self = Self(1);
743 #[doc(alias = "UIApplicationCategoryDefaultStatusNotDefault")]
745 pub const NotDefault: Self = Self(2);
746}
747
748unsafe impl Encode for UIApplicationCategoryDefaultStatus {
749 const ENCODING: Encoding = NSInteger::ENCODING;
750}
751
752unsafe impl RefEncode for UIApplicationCategoryDefaultStatus {
753 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
754}
755
756extern "C" {
757 pub static UIApplicationCategoryDefaultErrorDomain: &'static NSErrorDomain;
759}
760
761#[repr(transparent)]
764#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
765pub struct UIApplicationCategoryDefaultErrorCode(pub NSInteger);
766impl UIApplicationCategoryDefaultErrorCode {
767 #[doc(alias = "UIApplicationCategoryDefaultErrorRateLimited")]
769 pub const RateLimited: Self = Self(1);
770}
771
772unsafe impl Encode for UIApplicationCategoryDefaultErrorCode {
773 const ENCODING: Encoding = NSInteger::ENCODING;
774}
775
776unsafe impl RefEncode for UIApplicationCategoryDefaultErrorCode {
777 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
778}
779
780extern "C" {
781 pub static UIApplicationCategoryDefaultStatusLastProvidedDateErrorKey:
786 &'static NSErrorUserInfoKey;
787}
788
789extern "C" {
790 pub static UIApplicationCategoryDefaultRetryAvailabilityDateErrorKey:
795 &'static NSErrorUserInfoKey;
796}
797
798#[cfg(feature = "UIResponder")]
800impl UIApplication {
801 extern_methods!();
802}
803
804pub type UIApplicationLaunchOptionsKey = NSString;
807
808#[deprecated = "Use UIScene lifecycle and equivalent properties on UISceneOpenURLOptions from a UIOpenURLContext in UIScene.ConnectionOptions.URLContexts instead."]
810pub type UIApplicationOpenURLOptionsKey = NSString;
812
813pub type UIApplicationExtensionPointIdentifier = NSString;
816
817extern_protocol!(
818 pub unsafe trait UIApplicationDelegate: NSObjectProtocol + MainThreadOnly {
820 #[cfg(feature = "UIResponder")]
821 #[optional]
822 #[unsafe(method(applicationDidFinishLaunching:))]
823 #[unsafe(method_family = none)]
824 fn applicationDidFinishLaunching(&self, application: &UIApplication);
825
826 #[cfg(feature = "UIResponder")]
827 #[optional]
831 #[unsafe(method(application:willFinishLaunchingWithOptions:))]
832 #[unsafe(method_family = none)]
833 unsafe fn application_willFinishLaunchingWithOptions(
834 &self,
835 application: &UIApplication,
836 launch_options: Option<&NSDictionary<UIApplicationLaunchOptionsKey, AnyObject>>,
837 ) -> bool;
838
839 #[cfg(feature = "UIResponder")]
840 #[optional]
844 #[unsafe(method(application:didFinishLaunchingWithOptions:))]
845 #[unsafe(method_family = none)]
846 unsafe fn application_didFinishLaunchingWithOptions(
847 &self,
848 application: &UIApplication,
849 launch_options: Option<&NSDictionary<UIApplicationLaunchOptionsKey, AnyObject>>,
850 ) -> bool;
851
852 #[cfg(feature = "UIResponder")]
853 #[deprecated = "Use UIScene lifecycle and sceneDidBecomeActive(_:) from UISceneDelegate or the UIApplication.didBecomeActiveNotification instead."]
856 #[optional]
857 #[unsafe(method(applicationDidBecomeActive:))]
858 #[unsafe(method_family = none)]
859 fn applicationDidBecomeActive(&self, application: &UIApplication);
860
861 #[cfg(feature = "UIResponder")]
862 #[deprecated = "Use UIScene lifecycle and sceneWillResignActive(_:) from UISceneDelegate or the UIApplication.willResignActiveNotification instead."]
865 #[optional]
866 #[unsafe(method(applicationWillResignActive:))]
867 #[unsafe(method_family = none)]
868 fn applicationWillResignActive(&self, application: &UIApplication);
869
870 #[cfg(feature = "UIResponder")]
871 #[deprecated = "Use UIScene lifecycle and sceneDidEnterBackground(_:) from UISceneDelegate or the UIApplication.didEnterBackgroundNotification instead."]
874 #[optional]
875 #[unsafe(method(applicationDidEnterBackground:))]
876 #[unsafe(method_family = none)]
877 fn applicationDidEnterBackground(&self, application: &UIApplication);
878
879 #[cfg(feature = "UIResponder")]
880 #[deprecated = "Use UIScene lifecycle and sceneWillEnterForeground(_:) from UISceneDelegate or the UIApplication.willEnterForegroundNotification instead."]
883 #[optional]
884 #[unsafe(method(applicationWillEnterForeground:))]
885 #[unsafe(method_family = none)]
886 fn applicationWillEnterForeground(&self, application: &UIApplication);
887
888 #[cfg(feature = "UIResponder")]
889 #[deprecated]
890 #[optional]
891 #[unsafe(method(application:handleOpenURL:))]
892 #[unsafe(method_family = none)]
893 fn application_handleOpenURL(&self, application: &UIApplication, url: &NSURL) -> bool;
894
895 #[cfg(feature = "UIResponder")]
896 #[deprecated]
900 #[optional]
901 #[unsafe(method(application:openURL:sourceApplication:annotation:))]
902 #[unsafe(method_family = none)]
903 unsafe fn application_openURL_sourceApplication_annotation(
904 &self,
905 application: &UIApplication,
906 url: &NSURL,
907 source_application: Option<&NSString>,
908 annotation: &AnyObject,
909 ) -> bool;
910
911 #[cfg(feature = "UIResponder")]
912 #[deprecated = "Use UIScene lifecycle and scene(_:openURLContexts:) from UISceneDelegate instead."]
918 #[optional]
919 #[unsafe(method(application:openURL:options:))]
920 #[unsafe(method_family = none)]
921 unsafe fn application_openURL_options(
922 &self,
923 app: &UIApplication,
924 url: &NSURL,
925 options: &NSDictionary<UIApplicationOpenURLOptionsKey, AnyObject>,
926 ) -> bool;
927
928 #[cfg(feature = "UIResponder")]
929 #[optional]
930 #[unsafe(method(applicationDidReceiveMemoryWarning:))]
931 #[unsafe(method_family = none)]
932 fn applicationDidReceiveMemoryWarning(&self, application: &UIApplication);
933
934 #[cfg(feature = "UIResponder")]
935 #[optional]
936 #[unsafe(method(applicationWillTerminate:))]
937 #[unsafe(method_family = none)]
938 fn applicationWillTerminate(&self, application: &UIApplication);
939
940 #[cfg(feature = "UIResponder")]
941 #[optional]
942 #[unsafe(method(applicationSignificantTimeChange:))]
943 #[unsafe(method_family = none)]
944 fn applicationSignificantTimeChange(&self, application: &UIApplication);
945
946 #[cfg(all(feature = "UIOrientation", feature = "UIResponder"))]
947 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
948 #[optional]
949 #[unsafe(method(application:willChangeStatusBarOrientation:duration:))]
950 #[unsafe(method_family = none)]
951 fn application_willChangeStatusBarOrientation_duration(
952 &self,
953 application: &UIApplication,
954 new_status_bar_orientation: UIInterfaceOrientation,
955 duration: NSTimeInterval,
956 );
957
958 #[cfg(all(feature = "UIOrientation", feature = "UIResponder"))]
959 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
960 #[optional]
961 #[unsafe(method(application:didChangeStatusBarOrientation:))]
962 #[unsafe(method_family = none)]
963 fn application_didChangeStatusBarOrientation(
964 &self,
965 application: &UIApplication,
966 old_status_bar_orientation: UIInterfaceOrientation,
967 );
968
969 #[cfg(all(feature = "UIResponder", feature = "objc2-core-foundation"))]
970 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
971 #[optional]
972 #[unsafe(method(application:willChangeStatusBarFrame:))]
973 #[unsafe(method_family = none)]
974 fn application_willChangeStatusBarFrame(
975 &self,
976 application: &UIApplication,
977 new_status_bar_frame: CGRect,
978 );
979
980 #[cfg(all(feature = "UIResponder", feature = "objc2-core-foundation"))]
981 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
982 #[optional]
983 #[unsafe(method(application:didChangeStatusBarFrame:))]
984 #[unsafe(method_family = none)]
985 fn application_didChangeStatusBarFrame(
986 &self,
987 application: &UIApplication,
988 old_status_bar_frame: CGRect,
989 );
990
991 #[cfg(all(feature = "UIResponder", feature = "UIUserNotificationSettings"))]
992 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:]"]
993 #[optional]
994 #[unsafe(method(application:didRegisterUserNotificationSettings:))]
995 #[unsafe(method_family = none)]
996 fn application_didRegisterUserNotificationSettings(
997 &self,
998 application: &UIApplication,
999 notification_settings: &UIUserNotificationSettings,
1000 );
1001
1002 #[cfg(feature = "UIResponder")]
1003 #[optional]
1004 #[unsafe(method(application:didRegisterForRemoteNotificationsWithDeviceToken:))]
1005 #[unsafe(method_family = none)]
1006 fn application_didRegisterForRemoteNotificationsWithDeviceToken(
1007 &self,
1008 application: &UIApplication,
1009 device_token: &NSData,
1010 );
1011
1012 #[cfg(feature = "UIResponder")]
1013 #[optional]
1014 #[unsafe(method(application:didFailToRegisterForRemoteNotificationsWithError:))]
1015 #[unsafe(method_family = none)]
1016 fn application_didFailToRegisterForRemoteNotificationsWithError(
1017 &self,
1018 application: &UIApplication,
1019 error: &NSError,
1020 );
1021
1022 #[cfg(feature = "UIResponder")]
1023 #[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"]
1027 #[optional]
1028 #[unsafe(method(application:didReceiveRemoteNotification:))]
1029 #[unsafe(method_family = none)]
1030 unsafe fn application_didReceiveRemoteNotification(
1031 &self,
1032 application: &UIApplication,
1033 user_info: &NSDictionary,
1034 );
1035
1036 #[cfg(all(feature = "UILocalNotification", feature = "UIResponder"))]
1037 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate willPresentNotification:withCompletionHandler:] or -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1038 #[optional]
1039 #[unsafe(method(application:didReceiveLocalNotification:))]
1040 #[unsafe(method_family = none)]
1041 fn application_didReceiveLocalNotification(
1042 &self,
1043 application: &UIApplication,
1044 notification: &UILocalNotification,
1045 );
1046
1047 #[cfg(all(
1048 feature = "UILocalNotification",
1049 feature = "UIResponder",
1050 feature = "block2"
1051 ))]
1052 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1053 #[optional]
1054 #[unsafe(method(application:handleActionWithIdentifier:forLocalNotification:completionHandler:))]
1055 #[unsafe(method_family = none)]
1056 fn application_handleActionWithIdentifier_forLocalNotification_completionHandler(
1057 &self,
1058 application: &UIApplication,
1059 identifier: Option<&NSString>,
1060 notification: &UILocalNotification,
1061 completion_handler: &block2::DynBlock<dyn Fn()>,
1062 );
1063
1064 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1065 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1070 #[optional]
1071 #[unsafe(method(application:handleActionWithIdentifier:forRemoteNotification:withResponseInfo:completionHandler:))]
1072 #[unsafe(method_family = none)]
1073 unsafe fn application_handleActionWithIdentifier_forRemoteNotification_withResponseInfo_completionHandler(
1074 &self,
1075 application: &UIApplication,
1076 identifier: Option<&NSString>,
1077 user_info: &NSDictionary,
1078 response_info: &NSDictionary,
1079 completion_handler: &block2::DynBlock<dyn Fn()>,
1080 );
1081
1082 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1083 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1087 #[optional]
1088 #[unsafe(method(application:handleActionWithIdentifier:forRemoteNotification:completionHandler:))]
1089 #[unsafe(method_family = none)]
1090 unsafe fn application_handleActionWithIdentifier_forRemoteNotification_completionHandler(
1091 &self,
1092 application: &UIApplication,
1093 identifier: Option<&NSString>,
1094 user_info: &NSDictionary,
1095 completion_handler: &block2::DynBlock<dyn Fn()>,
1096 );
1097
1098 #[cfg(all(
1099 feature = "UILocalNotification",
1100 feature = "UIResponder",
1101 feature = "block2"
1102 ))]
1103 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1107 #[optional]
1108 #[unsafe(method(application:handleActionWithIdentifier:forLocalNotification:withResponseInfo:completionHandler:))]
1109 #[unsafe(method_family = none)]
1110 unsafe fn application_handleActionWithIdentifier_forLocalNotification_withResponseInfo_completionHandler(
1111 &self,
1112 application: &UIApplication,
1113 identifier: Option<&NSString>,
1114 notification: &UILocalNotification,
1115 response_info: &NSDictionary,
1116 completion_handler: &block2::DynBlock<dyn Fn()>,
1117 );
1118
1119 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1120 #[optional]
1128 #[unsafe(method(application:didReceiveRemoteNotification:fetchCompletionHandler:))]
1129 #[unsafe(method_family = none)]
1130 unsafe fn application_didReceiveRemoteNotification_fetchCompletionHandler(
1131 &self,
1132 application: &UIApplication,
1133 user_info: &NSDictionary,
1134 completion_handler: &block2::DynBlock<dyn Fn(UIBackgroundFetchResult)>,
1135 );
1136
1137 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1138 #[deprecated = "Use a BGAppRefreshTask in the BackgroundTasks framework instead"]
1140 #[optional]
1141 #[unsafe(method(application:performFetchWithCompletionHandler:))]
1142 #[unsafe(method_family = none)]
1143 fn application_performFetchWithCompletionHandler(
1144 &self,
1145 application: &UIApplication,
1146 completion_handler: &block2::DynBlock<dyn Fn(UIBackgroundFetchResult)>,
1147 );
1148
1149 #[cfg(all(
1150 feature = "UIApplicationShortcutItem",
1151 feature = "UIResponder",
1152 feature = "block2"
1153 ))]
1154 #[deprecated = "Use UIScene lifecycle and windowScene(_:performActionFor:completionHandler:) from UIWindowSceneDelegate instead."]
1157 #[optional]
1158 #[unsafe(method(application:performActionForShortcutItem:completionHandler:))]
1159 #[unsafe(method_family = none)]
1160 fn application_performActionForShortcutItem_completionHandler(
1161 &self,
1162 application: &UIApplication,
1163 shortcut_item: &UIApplicationShortcutItem,
1164 completion_handler: &block2::DynBlock<dyn Fn(Bool)>,
1165 );
1166
1167 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1168 #[optional]
1169 #[unsafe(method(application:handleEventsForBackgroundURLSession:completionHandler:))]
1170 #[unsafe(method_family = none)]
1171 fn application_handleEventsForBackgroundURLSession_completionHandler(
1172 &self,
1173 application: &UIApplication,
1174 identifier: &NSString,
1175 completion_handler: &block2::DynBlock<dyn Fn()>,
1176 );
1177
1178 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1179 #[optional]
1183 #[unsafe(method(application:handleWatchKitExtensionRequest:reply:))]
1184 #[unsafe(method_family = none)]
1185 unsafe fn application_handleWatchKitExtensionRequest_reply(
1186 &self,
1187 application: &UIApplication,
1188 user_info: Option<&NSDictionary>,
1189 reply: &block2::DynBlock<dyn Fn(*mut NSDictionary)>,
1190 );
1191
1192 #[cfg(feature = "UIResponder")]
1193 #[optional]
1194 #[unsafe(method(applicationShouldRequestHealthAuthorization:))]
1195 #[unsafe(method_family = none)]
1196 fn applicationShouldRequestHealthAuthorization(&self, application: &UIApplication);
1197
1198 #[cfg(feature = "UIResponder")]
1199 #[optional]
1200 #[unsafe(method(applicationProtectedDataWillBecomeUnavailable:))]
1201 #[unsafe(method_family = none)]
1202 fn applicationProtectedDataWillBecomeUnavailable(&self, application: &UIApplication);
1203
1204 #[cfg(feature = "UIResponder")]
1205 #[optional]
1206 #[unsafe(method(applicationProtectedDataDidBecomeAvailable:))]
1207 #[unsafe(method_family = none)]
1208 fn applicationProtectedDataDidBecomeAvailable(&self, application: &UIApplication);
1209
1210 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
1211 #[optional]
1212 #[unsafe(method(window))]
1213 #[unsafe(method_family = none)]
1214 fn window(&self) -> Option<Retained<UIWindow>>;
1215
1216 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
1217 #[optional]
1219 #[unsafe(method(setWindow:))]
1220 #[unsafe(method_family = none)]
1221 fn setWindow(&self, window: Option<&UIWindow>);
1222
1223 #[cfg(all(
1224 feature = "UIOrientation",
1225 feature = "UIResponder",
1226 feature = "UIView",
1227 feature = "UIWindow"
1228 ))]
1229 #[optional]
1230 #[unsafe(method(application:supportedInterfaceOrientationsForWindow:))]
1231 #[unsafe(method_family = none)]
1232 fn application_supportedInterfaceOrientationsForWindow(
1233 &self,
1234 application: &UIApplication,
1235 window: Option<&UIWindow>,
1236 ) -> UIInterfaceOrientationMask;
1237
1238 #[cfg(feature = "UIResponder")]
1239 #[optional]
1240 #[unsafe(method(application:shouldAllowExtensionPointIdentifier:))]
1241 #[unsafe(method_family = none)]
1242 fn application_shouldAllowExtensionPointIdentifier(
1243 &self,
1244 application: &UIApplication,
1245 extension_point_identifier: &UIApplicationExtensionPointIdentifier,
1246 ) -> bool;
1247
1248 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
1249 #[optional]
1253 #[unsafe(method(application:viewControllerWithRestorationIdentifierPath:coder:))]
1254 #[unsafe(method_family = none)]
1255 unsafe fn application_viewControllerWithRestorationIdentifierPath_coder(
1256 &self,
1257 application: &UIApplication,
1258 identifier_components: &NSArray<NSString>,
1259 coder: &NSCoder,
1260 ) -> Option<Retained<UIViewController>>;
1261
1262 #[cfg(feature = "UIResponder")]
1263 #[optional]
1267 #[unsafe(method(application:shouldSaveSecureApplicationState:))]
1268 #[unsafe(method_family = none)]
1269 unsafe fn application_shouldSaveSecureApplicationState(
1270 &self,
1271 application: &UIApplication,
1272 coder: &NSCoder,
1273 ) -> bool;
1274
1275 #[cfg(feature = "UIResponder")]
1276 #[optional]
1280 #[unsafe(method(application:shouldRestoreSecureApplicationState:))]
1281 #[unsafe(method_family = none)]
1282 unsafe fn application_shouldRestoreSecureApplicationState(
1283 &self,
1284 application: &UIApplication,
1285 coder: &NSCoder,
1286 ) -> bool;
1287
1288 #[cfg(feature = "UIResponder")]
1289 #[optional]
1293 #[unsafe(method(application:willEncodeRestorableStateWithCoder:))]
1294 #[unsafe(method_family = none)]
1295 unsafe fn application_willEncodeRestorableStateWithCoder(
1296 &self,
1297 application: &UIApplication,
1298 coder: &NSCoder,
1299 );
1300
1301 #[cfg(feature = "UIResponder")]
1302 #[optional]
1306 #[unsafe(method(application:didDecodeRestorableStateWithCoder:))]
1307 #[unsafe(method_family = none)]
1308 unsafe fn application_didDecodeRestorableStateWithCoder(
1309 &self,
1310 application: &UIApplication,
1311 coder: &NSCoder,
1312 );
1313
1314 #[cfg(feature = "UIResponder")]
1315 #[deprecated = "Use application:shouldSaveSecureApplicationState: instead"]
1319 #[optional]
1320 #[unsafe(method(application:shouldSaveApplicationState:))]
1321 #[unsafe(method_family = none)]
1322 unsafe fn application_shouldSaveApplicationState(
1323 &self,
1324 application: &UIApplication,
1325 coder: &NSCoder,
1326 ) -> bool;
1327
1328 #[cfg(feature = "UIResponder")]
1329 #[deprecated = "Use application:shouldRestoreSecureApplicationState: instead"]
1333 #[optional]
1334 #[unsafe(method(application:shouldRestoreApplicationState:))]
1335 #[unsafe(method_family = none)]
1336 unsafe fn application_shouldRestoreApplicationState(
1337 &self,
1338 application: &UIApplication,
1339 coder: &NSCoder,
1340 ) -> bool;
1341
1342 #[cfg(feature = "UIResponder")]
1343 #[deprecated = "Use UIScene lifecycle and scene(_:willContinueUserActivityWithType:) from UISceneDelegate instead."]
1349 #[optional]
1350 #[unsafe(method(application:willContinueUserActivityWithType:))]
1351 #[unsafe(method_family = none)]
1352 fn application_willContinueUserActivityWithType(
1353 &self,
1354 application: &UIApplication,
1355 user_activity_type: &NSString,
1356 ) -> bool;
1357
1358 #[cfg(all(
1359 feature = "UIResponder",
1360 feature = "UIUserActivity",
1361 feature = "block2"
1362 ))]
1363 #[deprecated = "Use UIScene lifecycle and scene(_:continue:) from UISceneDelegate instead."]
1368 #[optional]
1369 #[unsafe(method(application:continueUserActivity:restorationHandler:))]
1370 #[unsafe(method_family = none)]
1371 fn application_continueUserActivity_restorationHandler(
1372 &self,
1373 application: &UIApplication,
1374 user_activity: &NSUserActivity,
1375 restoration_handler: &block2::DynBlock<
1376 dyn Fn(*mut NSArray<ProtocolObject<dyn UIUserActivityRestoring>>),
1377 >,
1378 ) -> bool;
1379
1380 #[cfg(feature = "UIResponder")]
1381 #[deprecated = "Use UIScene lifecycle and scene(_:didFailToContinueUserActivityWithType:error:) from UISceneDelegate instead."]
1383 #[optional]
1384 #[unsafe(method(application:didFailToContinueUserActivityWithType:error:))]
1385 #[unsafe(method_family = none)]
1386 fn application_didFailToContinueUserActivityWithType_error(
1387 &self,
1388 application: &UIApplication,
1389 user_activity_type: &NSString,
1390 error: &NSError,
1391 );
1392
1393 #[cfg(feature = "UIResponder")]
1394 #[deprecated = "Use UIScene lifecycle and scene(_:didUpdate) from UISceneDelegate instead."]
1396 #[optional]
1397 #[unsafe(method(application:didUpdateUserActivity:))]
1398 #[unsafe(method_family = none)]
1399 fn application_didUpdateUserActivity(
1400 &self,
1401 application: &UIApplication,
1402 user_activity: &NSUserActivity,
1403 );
1404
1405 #[cfg(all(feature = "UIResponder", feature = "objc2-cloud-kit"))]
1406 #[deprecated = "Use UIScene lifecycle and windowScene(_:userDidAcceptCloudKitShareWith:) from UIWindowSceneDelegate instead."]
1410 #[optional]
1411 #[unsafe(method(application:userDidAcceptCloudKitShareWithMetadata:))]
1412 #[unsafe(method_family = none)]
1413 fn application_userDidAcceptCloudKitShareWithMetadata(
1414 &self,
1415 application: &UIApplication,
1416 cloud_kit_share_metadata: &CKShareMetadata,
1417 );
1418
1419 #[cfg(all(
1420 feature = "UIResponder",
1421 feature = "UISceneConfiguration",
1422 feature = "UISceneOptions",
1423 feature = "UISceneSession"
1424 ))]
1425 #[optional]
1426 #[unsafe(method(application:configurationForConnectingSceneSession:options:))]
1427 #[unsafe(method_family = none)]
1428 fn application_configurationForConnectingSceneSession_options(
1429 &self,
1430 application: &UIApplication,
1431 connecting_scene_session: &UISceneSession,
1432 options: &UISceneConnectionOptions,
1433 ) -> Retained<UISceneConfiguration>;
1434
1435 #[cfg(all(feature = "UIResponder", feature = "UISceneSession"))]
1436 #[optional]
1437 #[unsafe(method(application:didDiscardSceneSessions:))]
1438 #[unsafe(method_family = none)]
1439 fn application_didDiscardSceneSessions(
1440 &self,
1441 application: &UIApplication,
1442 scene_sessions: &NSSet<UISceneSession>,
1443 );
1444
1445 #[cfg(feature = "UIResponder")]
1446 #[optional]
1447 #[unsafe(method(applicationShouldAutomaticallyLocalizeKeyCommands:))]
1448 #[unsafe(method_family = none)]
1449 fn applicationShouldAutomaticallyLocalizeKeyCommands(
1450 &self,
1451 application: &UIApplication,
1452 ) -> bool;
1453 }
1454);
1455
1456#[cfg(feature = "UIResponder")]
1458impl UIApplication {
1459 extern_methods!(
1460 #[deprecated]
1461 #[unsafe(method(isProximitySensingEnabled))]
1462 #[unsafe(method_family = none)]
1463 pub fn isProximitySensingEnabled(&self) -> bool;
1464
1465 #[deprecated]
1467 #[unsafe(method(setProximitySensingEnabled:))]
1468 #[unsafe(method_family = none)]
1469 pub fn setProximitySensingEnabled(&self, proximity_sensing_enabled: bool);
1470
1471 #[deprecated = "Use -[UIViewController prefersStatusBarHidden]"]
1472 #[unsafe(method(setStatusBarHidden:animated:))]
1473 #[unsafe(method_family = none)]
1474 pub fn setStatusBarHidden_animated(&self, hidden: bool, animated: bool);
1475
1476 #[cfg(feature = "UIOrientation")]
1477 #[deprecated = "Explicit setting of the status bar orientation is more limited in iOS 6.0 and later"]
1479 #[unsafe(method(setStatusBarOrientation:))]
1480 #[unsafe(method_family = none)]
1481 pub fn setStatusBarOrientation(&self, status_bar_orientation: UIInterfaceOrientation);
1482
1483 #[cfg(feature = "UIOrientation")]
1484 #[deprecated = "Explicit setting of the status bar orientation is more limited in iOS 6.0 and later"]
1485 #[unsafe(method(setStatusBarOrientation:animated:))]
1486 #[unsafe(method_family = none)]
1487 pub fn setStatusBarOrientation_animated(
1488 &self,
1489 interface_orientation: UIInterfaceOrientation,
1490 animated: bool,
1491 );
1492
1493 #[deprecated = "Use -[UIViewController preferredStatusBarStyle]"]
1495 #[unsafe(method(setStatusBarStyle:))]
1496 #[unsafe(method_family = none)]
1497 pub fn setStatusBarStyle(&self, status_bar_style: UIStatusBarStyle);
1498
1499 #[deprecated = "Use -[UIViewController preferredStatusBarStyle]"]
1500 #[unsafe(method(setStatusBarStyle:animated:))]
1501 #[unsafe(method_family = none)]
1502 pub fn setStatusBarStyle_animated(
1503 &self,
1504 status_bar_style: UIStatusBarStyle,
1505 animated: bool,
1506 );
1507
1508 #[deprecated = "Use -[UIViewController prefersStatusBarHidden]"]
1510 #[unsafe(method(setStatusBarHidden:))]
1511 #[unsafe(method_family = none)]
1512 pub fn setStatusBarHidden(&self, status_bar_hidden: bool);
1513
1514 #[deprecated = "Use -[UIViewController prefersStatusBarHidden]"]
1515 #[unsafe(method(setStatusBarHidden:withAnimation:))]
1516 #[unsafe(method_family = none)]
1517 pub fn setStatusBarHidden_withAnimation(
1518 &self,
1519 hidden: bool,
1520 animation: UIStatusBarAnimation,
1521 );
1522
1523 #[cfg(feature = "block2")]
1524 #[deprecated = "Please use PushKit for VoIP applications instead of calling this method"]
1525 #[unsafe(method(setKeepAliveTimeout:handler:))]
1526 #[unsafe(method_family = none)]
1527 pub fn setKeepAliveTimeout_handler(
1528 &self,
1529 timeout: NSTimeInterval,
1530 keep_alive_handler: Option<&block2::DynBlock<dyn Fn()>>,
1531 ) -> bool;
1532
1533 #[deprecated = "Please use PushKit for VoIP applications instead of calling this method"]
1534 #[unsafe(method(clearKeepAliveTimeout))]
1535 #[unsafe(method_family = none)]
1536 pub fn clearKeepAliveTimeout(&self);
1537 );
1538}
1539
1540#[cfg(feature = "UIResponder")]
1541impl UIApplication {
1542 #[doc(alias = "UIApplicationMain")]
1546 #[inline]
1547 pub(crate) unsafe fn __main(
1548 argc: c_int,
1549 argv: NonNull<*mut c_char>,
1550 principal_class_name: Option<&NSString>,
1551 delegate_class_name: Option<&NSString>,
1552 ) -> c_int {
1553 extern "C-unwind" {
1554 fn UIApplicationMain(
1555 argc: c_int,
1556 argv: NonNull<*mut c_char>,
1557 principal_class_name: Option<&NSString>,
1558 delegate_class_name: Option<&NSString>,
1559 ) -> c_int;
1560 }
1561 unsafe { UIApplicationMain(argc, argv, principal_class_name, delegate_class_name) }
1562 }
1563}
1564
1565extern "C" {
1566 pub static UITrackingRunLoopMode: &'static NSRunLoopMode;
1568}
1569
1570extern "C" {
1571 pub static UIApplicationDidEnterBackgroundNotification: &'static NSNotificationName;
1573}
1574
1575extern "C" {
1576 pub static UIApplicationWillEnterForegroundNotification: &'static NSNotificationName;
1578}
1579
1580extern "C" {
1581 pub static UIApplicationDidFinishLaunchingNotification: &'static NSNotificationName;
1583}
1584
1585extern "C" {
1586 pub static UIApplicationDidBecomeActiveNotification: &'static NSNotificationName;
1588}
1589
1590extern "C" {
1591 pub static UIApplicationWillResignActiveNotification: &'static NSNotificationName;
1593}
1594
1595extern "C" {
1596 pub static UIApplicationDidReceiveMemoryWarningNotification: &'static NSNotificationName;
1598}
1599
1600extern "C" {
1601 pub static UIApplicationWillTerminateNotification: &'static NSNotificationName;
1603}
1604
1605extern "C" {
1606 pub static UIApplicationSignificantTimeChangeNotification: &'static NSNotificationName;
1608}
1609
1610extern "C" {
1611 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
1613 pub static UIApplicationWillChangeStatusBarOrientationNotification: &'static NSNotificationName;
1614}
1615
1616extern "C" {
1617 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
1619 pub static UIApplicationDidChangeStatusBarOrientationNotification: &'static NSNotificationName;
1620}
1621
1622extern "C" {
1623 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
1625 pub static UIApplicationStatusBarOrientationUserInfoKey: &'static NSString;
1626}
1627
1628extern "C" {
1629 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
1631 pub static UIApplicationWillChangeStatusBarFrameNotification: &'static NSNotificationName;
1632}
1633
1634extern "C" {
1635 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
1637 pub static UIApplicationDidChangeStatusBarFrameNotification: &'static NSNotificationName;
1638}
1639
1640extern "C" {
1641 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
1643 pub static UIApplicationStatusBarFrameUserInfoKey: &'static NSString;
1644}
1645
1646extern "C" {
1647 pub static UIApplicationBackgroundRefreshStatusDidChangeNotification:
1649 &'static NSNotificationName;
1650}
1651
1652extern "C" {
1653 pub static UIApplicationProtectedDataWillBecomeUnavailable: &'static NSNotificationName;
1655}
1656
1657extern "C" {
1658 pub static UIApplicationProtectedDataDidBecomeAvailable: &'static NSNotificationName;
1660}
1661
1662extern "C" {
1663 #[deprecated = "Use UIScene lifecycle and UIScene.ConnectionOptions.URLContexts instead."]
1667 pub static UIApplicationLaunchOptionsURLKey: &'static UIApplicationLaunchOptionsKey;
1668}
1669
1670extern "C" {
1671 #[deprecated = "Use UIScene lifecycle and UIScene.ConnectionOptions.sourceApplication instead."]
1675 pub static UIApplicationLaunchOptionsSourceApplicationKey:
1676 &'static UIApplicationLaunchOptionsKey;
1677}
1678
1679extern "C" {
1680 #[deprecated = "Continue using UIApplicationDelegate's application(_:didReceiveRemoteNotification:fetchCompletionHandler:) to process silent remote notifications after scene connection."]
1684 pub static UIApplicationLaunchOptionsRemoteNotificationKey:
1685 &'static UIApplicationLaunchOptionsKey;
1686}
1687
1688extern "C" {
1689 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1693 pub static UIApplicationLaunchOptionsLocalNotificationKey:
1694 &'static UIApplicationLaunchOptionsKey;
1695}
1696
1697extern "C" {
1698 #[deprecated = "This dictionary key is no longer used."]
1702 pub static UIApplicationLaunchOptionsAnnotationKey: &'static UIApplicationLaunchOptionsKey;
1703}
1704
1705extern "C" {
1706 #[deprecated = "Adopt CLLocationUpdate or CLMonitor, or use CLLocationManagerDelegate from CoreLocation to handle expected location events after scene connection."]
1710 pub static UIApplicationLaunchOptionsLocationKey: &'static UIApplicationLaunchOptionsKey;
1711}
1712
1713extern "C" {
1714 #[deprecated = "This dictionary key is no longer used."]
1718 pub static UIApplicationLaunchOptionsNewsstandDownloadsKey:
1719 &'static UIApplicationLaunchOptionsKey;
1720}
1721
1722extern "C" {
1723 #[deprecated = "Store restoration identifiers and reinstantiate central managers with those identifiers on app launch to resume previous functionality."]
1727 pub static UIApplicationLaunchOptionsBluetoothCentralsKey:
1728 &'static UIApplicationLaunchOptionsKey;
1729}
1730
1731extern "C" {
1732 #[deprecated = "Store restoration identifiers and reinstantiate peripheral managers with those identifiers on app launch to resume previous functionality."]
1736 pub static UIApplicationLaunchOptionsBluetoothPeripheralsKey:
1737 &'static UIApplicationLaunchOptionsKey;
1738}
1739
1740extern "C" {
1741 #[deprecated = "Use UIScene lifecycle and UIScene.ConnectionOptions.shortcutItem instead."]
1745 pub static UIApplicationLaunchOptionsShortcutItemKey: &'static UIApplicationLaunchOptionsKey;
1746}
1747
1748extern "C" {
1749 #[deprecated = "Use UIScene lifecycle and UIScene.ConnectionOptions.eventAttribution instead."]
1753 pub static UIApplicationLaunchOptionsEventAttributionKey:
1754 &'static UIApplicationLaunchOptionsKey;
1755}
1756
1757extern "C" {
1758 #[deprecated = "Use UIScene lifecycle and UIScene.ConnectionOptions.userActivities instead."]
1763 pub static UIApplicationLaunchOptionsUserActivityDictionaryKey:
1764 &'static UIApplicationLaunchOptionsKey;
1765}
1766
1767extern "C" {
1768 #[deprecated = "Use UIScene lifecycle and UIScene.ConnectionOptions.handoffUserActivityType instead."]
1772 pub static UIApplicationLaunchOptionsUserActivityTypeKey:
1773 &'static UIApplicationLaunchOptionsKey;
1774}
1775
1776extern "C" {
1777 #[deprecated = "Use UIScene lifecycle and UIScene.ConnectionOptions.cloudKitShareMetadata instead."]
1781 pub static UIApplicationLaunchOptionsCloudKitShareMetadataKey:
1782 &'static UIApplicationLaunchOptionsKey;
1783}
1784
1785extern "C" {
1786 pub static UIApplicationOpenSettingsURLString: &'static NSString;
1788}
1789
1790extern "C" {
1791 pub static UIApplicationOpenDefaultApplicationsSettingsURLString: &'static NSString;
1795}
1796
1797extern "C" {
1798 pub static UIApplicationOpenNotificationSettingsURLString: &'static NSString;
1800}
1801
1802extern "C" {
1803 #[deprecated = "Use UIScene lifecycle and UISceneOpenURLOptions.sourceApplication from a UIOpenURLContext in UIScene.ConnectionOptions.URLContexts instead."]
1808 pub static UIApplicationOpenURLOptionsSourceApplicationKey:
1809 &'static UIApplicationOpenURLOptionsKey;
1810}
1811
1812extern "C" {
1813 #[deprecated = "Use UIScene lifecycle and UISceneOpenURLOptions.annotation from a UIOpenURLContext in UIScene.ConnectionOptions.URLContexts instead."]
1818 pub static UIApplicationOpenURLOptionsAnnotationKey: &'static UIApplicationOpenURLOptionsKey;
1819}
1820
1821extern "C" {
1822 #[deprecated = "Use UIScene lifecycle and UISceneOpenURLOptions.openInPlace from a UIOpenURLContext in UIScene.ConnectionOptions.URLContexts instead."]
1826 pub static UIApplicationOpenURLOptionsOpenInPlaceKey: &'static UIApplicationOpenURLOptionsKey;
1827}
1828
1829extern "C" {
1830 #[deprecated = "Use UIScene lifecycle and UISceneOpenURLOptions.eventAttribution from a UIOpenURLContext in UIScene.ConnectionOptions.URLContexts instead."]
1834 pub static UIApplicationOpenURLOptionsEventAttributionKey:
1835 &'static UIApplicationOpenURLOptionsKey;
1836}
1837
1838extern "C" {
1839 pub static UIApplicationUserDidTakeScreenshotNotification: &'static NSNotificationName;
1841}
1842
1843extern "C" {
1844 pub static UIApplicationKeyboardExtensionPointIdentifier:
1846 &'static UIApplicationExtensionPointIdentifier;
1847}
1848
1849extern "C" {
1850 pub static UIApplicationOpenURLOptionUniversalLinksOnly:
1852 &'static UIApplicationOpenExternalURLOptionsKey;
1853}
1854
1855extern "C" {
1856 pub static UIApplicationOpenExternalURLOptionsEventAttributionKey:
1858 &'static UIApplicationOpenExternalURLOptionsKey;
1859}
1860
1861extern "C-unwind" {
1862 #[deprecated = "renamed to `UIApplication::__main`"]
1863 pub fn UIApplicationMain(
1864 argc: c_int,
1865 argv: NonNull<*mut c_char>,
1866 principal_class_name: Option<&NSString>,
1867 delegate_class_name: Option<&NSString>,
1868 ) -> c_int;
1869}