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 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")]
207extern_conformance!(
208 unsafe impl NSObjectProtocol for UIApplication {}
209);
210
211#[cfg(feature = "UIResponder")]
212extern_conformance!(
213 unsafe impl UIResponderStandardEditActions for UIApplication {}
214);
215
216#[cfg(feature = "UIResponder")]
217impl UIApplication {
218 extern_methods!(
219 #[unsafe(method(sharedApplication))]
220 #[unsafe(method_family = none)]
221 pub fn sharedApplication(mtm: MainThreadMarker) -> Retained<UIApplication>;
222
223 #[unsafe(method(delegate))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn delegate(
226 &self,
227 ) -> Option<Retained<ProtocolObject<dyn UIApplicationDelegate>>>;
228
229 #[unsafe(method(setDelegate:))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn setDelegate(
233 &self,
234 delegate: Option<&ProtocolObject<dyn UIApplicationDelegate>>,
235 );
236
237 #[deprecated = "Use UIView's userInteractionEnabled property instead"]
238 #[unsafe(method(beginIgnoringInteractionEvents))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn beginIgnoringInteractionEvents(&self);
241
242 #[deprecated = "Use UIView's userInteractionEnabled property instead"]
243 #[unsafe(method(endIgnoringInteractionEvents))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn endIgnoringInteractionEvents(&self);
246
247 #[deprecated = "Use UIView's userInteractionEnabled property instead"]
248 #[unsafe(method(isIgnoringInteractionEvents))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn isIgnoringInteractionEvents(&self) -> bool;
251
252 #[unsafe(method(isIdleTimerDisabled))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn isIdleTimerDisabled(&self) -> bool;
255
256 #[unsafe(method(setIdleTimerDisabled:))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn setIdleTimerDisabled(&self, idle_timer_disabled: bool);
260
261 #[deprecated]
262 #[unsafe(method(openURL:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn openURL(&self, url: &NSURL) -> bool;
265
266 #[unsafe(method(canOpenURL:))]
267 #[unsafe(method_family = none)]
268 pub unsafe fn canOpenURL(&self, url: &NSURL) -> bool;
269
270 #[cfg(feature = "block2")]
271 #[unsafe(method(openURL:options:completionHandler:))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn openURL_options_completionHandler(
274 &self,
275 url: &NSURL,
276 options: &NSDictionary<UIApplicationOpenExternalURLOptionsKey, AnyObject>,
277 completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
278 );
279
280 #[cfg(feature = "UIEvent")]
281 #[unsafe(method(sendEvent:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn sendEvent(&self, event: &UIEvent);
284
285 #[cfg(all(feature = "UIView", feature = "UIWindow"))]
286 #[deprecated = "Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes"]
287 #[unsafe(method(keyWindow))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn keyWindow(&self) -> Option<Retained<UIWindow>>;
290
291 #[cfg(all(feature = "UIView", feature = "UIWindow"))]
292 #[deprecated = "Use UIWindowScene.windows on a relevant window scene instead"]
293 #[unsafe(method(windows))]
294 #[unsafe(method_family = none)]
295 pub fn windows(&self) -> Retained<NSArray<UIWindow>>;
296
297 #[cfg(feature = "UIEvent")]
298 #[unsafe(method(sendAction:to:from:forEvent:))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn sendAction_to_from_forEvent(
301 &self,
302 action: Sel,
303 target: Option<&AnyObject>,
304 sender: Option<&AnyObject>,
305 event: Option<&UIEvent>,
306 ) -> bool;
307
308 #[deprecated = "Provide a custom network activity UI in your app if desired."]
309 #[unsafe(method(isNetworkActivityIndicatorVisible))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn isNetworkActivityIndicatorVisible(&self) -> bool;
312
313 #[deprecated = "Provide a custom network activity UI in your app if desired."]
315 #[unsafe(method(setNetworkActivityIndicatorVisible:))]
316 #[unsafe(method_family = none)]
317 pub unsafe fn setNetworkActivityIndicatorVisible(
318 &self,
319 network_activity_indicator_visible: bool,
320 );
321
322 #[cfg(all(feature = "UIOrientation", feature = "UIView", feature = "UIWindow"))]
323 #[unsafe(method(supportedInterfaceOrientationsForWindow:))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn supportedInterfaceOrientationsForWindow(
326 &self,
327 window: Option<&UIWindow>,
328 ) -> UIInterfaceOrientationMask;
329
330 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
331 #[unsafe(method(statusBarOrientationAnimationDuration))]
332 #[unsafe(method_family = none)]
333 pub unsafe fn statusBarOrientationAnimationDuration(&self) -> NSTimeInterval;
334
335 #[cfg(feature = "objc2-core-foundation")]
336 #[deprecated = "Use the statusBarManager property of the window scene instead."]
337 #[unsafe(method(statusBarFrame))]
338 #[unsafe(method_family = none)]
339 pub fn statusBarFrame(&self) -> CGRect;
340
341 #[deprecated = "Use -[UNUserNotificationCenter setBadgeCount:withCompletionHandler:] instead."]
342 #[unsafe(method(applicationIconBadgeNumber))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn applicationIconBadgeNumber(&self) -> NSInteger;
345
346 #[deprecated = "Use -[UNUserNotificationCenter setBadgeCount:withCompletionHandler:] instead."]
348 #[unsafe(method(setApplicationIconBadgeNumber:))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn setApplicationIconBadgeNumber(
351 &self,
352 application_icon_badge_number: NSInteger,
353 );
354
355 #[unsafe(method(applicationSupportsShakeToEdit))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn applicationSupportsShakeToEdit(&self) -> bool;
358
359 #[unsafe(method(setApplicationSupportsShakeToEdit:))]
361 #[unsafe(method_family = none)]
362 pub unsafe fn setApplicationSupportsShakeToEdit(
363 &self,
364 application_supports_shake_to_edit: bool,
365 );
366
367 #[unsafe(method(applicationState))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn applicationState(&self) -> UIApplicationState;
370
371 #[unsafe(method(backgroundTimeRemaining))]
372 #[unsafe(method_family = none)]
373 pub unsafe fn backgroundTimeRemaining(&self) -> NSTimeInterval;
374
375 #[cfg(feature = "block2")]
376 #[unsafe(method(beginBackgroundTaskWithExpirationHandler:))]
377 #[unsafe(method_family = none)]
378 pub unsafe fn beginBackgroundTaskWithExpirationHandler(
379 &self,
380 handler: Option<&block2::DynBlock<dyn Fn()>>,
381 ) -> UIBackgroundTaskIdentifier;
382
383 #[cfg(feature = "block2")]
384 #[unsafe(method(beginBackgroundTaskWithName:expirationHandler:))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn beginBackgroundTaskWithName_expirationHandler(
387 &self,
388 task_name: Option<&NSString>,
389 handler: Option<&block2::DynBlock<dyn Fn()>>,
390 ) -> UIBackgroundTaskIdentifier;
391
392 #[unsafe(method(endBackgroundTask:))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn endBackgroundTask(&self, identifier: UIBackgroundTaskIdentifier);
395
396 #[deprecated = "Use a BGAppRefreshTask in the BackgroundTasks framework instead"]
405 #[unsafe(method(setMinimumBackgroundFetchInterval:))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn setMinimumBackgroundFetchInterval(
408 &self,
409 minimum_background_fetch_interval: NSTimeInterval,
410 );
411
412 #[unsafe(method(backgroundRefreshStatus))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn backgroundRefreshStatus(&self) -> UIBackgroundRefreshStatus;
418
419 #[unsafe(method(isProtectedDataAvailable))]
420 #[unsafe(method_family = none)]
421 pub unsafe fn isProtectedDataAvailable(&self) -> bool;
422
423 #[cfg(feature = "UIInterface")]
424 #[unsafe(method(userInterfaceLayoutDirection))]
425 #[unsafe(method_family = none)]
426 pub unsafe fn userInterfaceLayoutDirection(&self) -> UIUserInterfaceLayoutDirection;
427
428 #[cfg(feature = "UIContentSizeCategory")]
429 #[unsafe(method(preferredContentSizeCategory))]
430 #[unsafe(method_family = none)]
431 pub unsafe fn preferredContentSizeCategory(&self) -> Retained<UIContentSizeCategory>;
432
433 #[cfg(feature = "UIScene")]
434 #[unsafe(method(connectedScenes))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn connectedScenes(&self) -> Retained<NSSet<UIScene>>;
437
438 #[cfg(feature = "UISceneSession")]
439 #[unsafe(method(openSessions))]
440 #[unsafe(method_family = none)]
441 pub unsafe fn openSessions(&self) -> Retained<NSSet<UISceneSession>>;
442
443 #[unsafe(method(supportsMultipleScenes))]
444 #[unsafe(method_family = none)]
445 pub unsafe fn supportsMultipleScenes(&self) -> bool;
446
447 #[cfg(all(feature = "UISceneSessionActivationRequest", feature = "block2"))]
448 #[unsafe(method(activateSceneSessionForRequest:errorHandler:))]
453 #[unsafe(method_family = none)]
454 pub unsafe fn activateSceneSessionForRequest_errorHandler(
455 &self,
456 request: &UISceneSessionActivationRequest,
457 error_handler: Option<&block2::DynBlock<dyn Fn(NonNull<NSError>)>>,
458 );
459
460 #[cfg(all(
461 feature = "UISceneOptions",
462 feature = "UISceneSession",
463 feature = "block2"
464 ))]
465 #[deprecated = "Please use activateSceneSessionForRequest:errorHandler:"]
466 #[unsafe(method(requestSceneSessionActivation:userActivity:options:errorHandler:))]
467 #[unsafe(method_family = none)]
468 pub unsafe fn requestSceneSessionActivation_userActivity_options_errorHandler(
469 &self,
470 scene_session: Option<&UISceneSession>,
471 user_activity: Option<&NSUserActivity>,
472 options: Option<&UISceneActivationRequestOptions>,
473 error_handler: Option<&block2::DynBlock<dyn Fn(NonNull<NSError>)>>,
474 );
475
476 #[cfg(all(
477 feature = "UISceneOptions",
478 feature = "UISceneSession",
479 feature = "block2"
480 ))]
481 #[unsafe(method(requestSceneSessionDestruction:options:errorHandler:))]
482 #[unsafe(method_family = none)]
483 pub unsafe fn requestSceneSessionDestruction_options_errorHandler(
484 &self,
485 scene_session: &UISceneSession,
486 options: Option<&UISceneDestructionRequestOptions>,
487 error_handler: Option<&block2::DynBlock<dyn Fn(NonNull<NSError>)>>,
488 );
489
490 #[cfg(feature = "UISceneSession")]
491 #[unsafe(method(requestSceneSessionRefresh:))]
492 #[unsafe(method_family = none)]
493 pub unsafe fn requestSceneSessionRefresh(&self, scene_session: &UISceneSession);
494 );
495}
496
497#[cfg(feature = "UIResponder")]
499impl UIApplication {
500 extern_methods!(
501 #[unsafe(method(init))]
502 #[unsafe(method_family = init)]
503 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
504
505 #[unsafe(method(new))]
506 #[unsafe(method_family = new)]
507 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
508 );
509}
510
511#[cfg(feature = "UIResponder")]
513impl UIApplication {
514 extern_methods!(
515 #[unsafe(method(registerForRemoteNotifications))]
516 #[unsafe(method_family = none)]
517 pub unsafe fn registerForRemoteNotifications(&self);
518
519 #[unsafe(method(unregisterForRemoteNotifications))]
520 #[unsafe(method_family = none)]
521 pub unsafe fn unregisterForRemoteNotifications(&self);
522
523 #[unsafe(method(isRegisteredForRemoteNotifications))]
524 #[unsafe(method_family = none)]
525 pub unsafe fn isRegisteredForRemoteNotifications(&self) -> bool;
526
527 #[deprecated = "Use -[UIApplication registerForRemoteNotifications] and UserNotifications Framework's -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:]"]
528 #[unsafe(method(registerForRemoteNotificationTypes:))]
529 #[unsafe(method_family = none)]
530 pub unsafe fn registerForRemoteNotificationTypes(&self, types: UIRemoteNotificationType);
531
532 #[deprecated = "Use -[UIApplication isRegisteredForRemoteNotifications] and UserNotifications Framework's -[UNUserNotificationCenter getNotificationSettingsWithCompletionHandler:] to retrieve user-enabled remote notification and user notification settings"]
533 #[unsafe(method(enabledRemoteNotificationTypes))]
534 #[unsafe(method_family = none)]
535 pub unsafe fn enabledRemoteNotificationTypes(&self) -> UIRemoteNotificationType;
536 );
537}
538
539#[cfg(feature = "UIResponder")]
541impl UIApplication {
542 extern_methods!(
543 #[cfg(feature = "UILocalNotification")]
544 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter addNotificationRequest:withCompletionHandler:]"]
545 #[unsafe(method(presentLocalNotificationNow:))]
546 #[unsafe(method_family = none)]
547 pub unsafe fn presentLocalNotificationNow(&self, notification: &UILocalNotification);
548
549 #[cfg(feature = "UILocalNotification")]
550 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter addNotificationRequest:withCompletionHandler:]"]
551 #[unsafe(method(scheduleLocalNotification:))]
552 #[unsafe(method_family = none)]
553 pub unsafe fn scheduleLocalNotification(&self, notification: &UILocalNotification);
554
555 #[cfg(feature = "UILocalNotification")]
556 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter removePendingNotificationRequestsWithIdentifiers:]"]
557 #[unsafe(method(cancelLocalNotification:))]
558 #[unsafe(method_family = none)]
559 pub unsafe fn cancelLocalNotification(&self, notification: &UILocalNotification);
560
561 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter removeAllPendingNotificationRequests]"]
562 #[unsafe(method(cancelAllLocalNotifications))]
563 #[unsafe(method_family = none)]
564 pub unsafe fn cancelAllLocalNotifications(&self);
565
566 #[cfg(feature = "UILocalNotification")]
567 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter getPendingNotificationRequestsWithCompletionHandler:]"]
568 #[unsafe(method(scheduledLocalNotifications))]
569 #[unsafe(method_family = none)]
570 pub unsafe fn scheduledLocalNotifications(
571 &self,
572 ) -> Option<Retained<NSArray<UILocalNotification>>>;
573
574 #[cfg(feature = "UILocalNotification")]
575 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter getPendingNotificationRequestsWithCompletionHandler:]"]
577 #[unsafe(method(setScheduledLocalNotifications:))]
578 #[unsafe(method_family = none)]
579 pub unsafe fn setScheduledLocalNotifications(
580 &self,
581 scheduled_local_notifications: Option<&NSArray<UILocalNotification>>,
582 );
583 );
584}
585
586#[cfg(feature = "UIResponder")]
588impl UIApplication {
589 extern_methods!(
590 #[cfg(feature = "UIUserNotificationSettings")]
591 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:] and -[UNUserNotificationCenter setNotificationCategories:]"]
592 #[unsafe(method(registerUserNotificationSettings:))]
593 #[unsafe(method_family = none)]
594 pub unsafe fn registerUserNotificationSettings(
595 &self,
596 notification_settings: &UIUserNotificationSettings,
597 );
598
599 #[cfg(feature = "UIUserNotificationSettings")]
600 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter getNotificationSettingsWithCompletionHandler:] and -[UNUserNotificationCenter getNotificationCategoriesWithCompletionHandler:]"]
601 #[unsafe(method(currentUserNotificationSettings))]
602 #[unsafe(method_family = none)]
603 pub unsafe fn currentUserNotificationSettings(
604 &self,
605 ) -> Option<Retained<UIUserNotificationSettings>>;
606 );
607}
608
609#[cfg(feature = "UIResponder")]
611impl UIApplication {
612 extern_methods!(
613 #[unsafe(method(beginReceivingRemoteControlEvents))]
614 #[unsafe(method_family = none)]
615 pub unsafe fn beginReceivingRemoteControlEvents(&self);
616
617 #[unsafe(method(endReceivingRemoteControlEvents))]
618 #[unsafe(method_family = none)]
619 pub unsafe fn endReceivingRemoteControlEvents(&self);
620 );
621}
622
623#[cfg(feature = "UIResponder")]
625impl UIApplication {
626 extern_methods!(
627 #[cfg(feature = "UIImage")]
628 #[deprecated = "Newsstand apps now behave like normal apps on SpringBoard"]
629 #[unsafe(method(setNewsstandIconImage:))]
630 #[unsafe(method_family = none)]
631 pub unsafe fn setNewsstandIconImage(&self, image: Option<&UIImage>);
632 );
633}
634
635#[cfg(feature = "UIResponder")]
637impl UIApplication {
638 extern_methods!(
639 #[cfg(feature = "UIApplicationShortcutItem")]
640 #[unsafe(method(shortcutItems))]
641 #[unsafe(method_family = none)]
642 pub unsafe fn shortcutItems(&self) -> Option<Retained<NSArray<UIApplicationShortcutItem>>>;
643
644 #[cfg(feature = "UIApplicationShortcutItem")]
645 #[unsafe(method(setShortcutItems:))]
647 #[unsafe(method_family = none)]
648 pub unsafe fn setShortcutItems(
649 &self,
650 shortcut_items: Option<&NSArray<UIApplicationShortcutItem>>,
651 );
652 );
653}
654
655#[cfg(feature = "UIResponder")]
657impl UIApplication {
658 extern_methods!(
659 #[unsafe(method(supportsAlternateIcons))]
660 #[unsafe(method_family = none)]
661 pub unsafe fn supportsAlternateIcons(&self) -> bool;
662
663 #[cfg(feature = "block2")]
664 #[unsafe(method(setAlternateIconName:completionHandler:))]
665 #[unsafe(method_family = none)]
666 pub unsafe fn setAlternateIconName_completionHandler(
667 &self,
668 alternate_icon_name: Option<&NSString>,
669 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
670 );
671
672 #[unsafe(method(alternateIconName))]
673 #[unsafe(method_family = none)]
674 pub unsafe fn alternateIconName(&self) -> Option<Retained<NSString>>;
675 );
676}
677
678#[cfg(feature = "UIResponder")]
680impl UIApplication {
681 extern_methods!(
682 #[unsafe(method(extendStateRestoration))]
683 #[unsafe(method_family = none)]
684 pub unsafe fn extendStateRestoration(&self);
685
686 #[unsafe(method(completeStateRestoration))]
687 #[unsafe(method_family = none)]
688 pub unsafe fn completeStateRestoration(&self);
689
690 #[unsafe(method(ignoreSnapshotOnNextApplicationLaunch))]
691 #[unsafe(method_family = none)]
692 pub unsafe fn ignoreSnapshotOnNextApplicationLaunch(&self);
693
694 #[cfg(feature = "UIStateRestoration")]
695 #[unsafe(method(registerObjectForStateRestoration:restorationIdentifier:))]
696 #[unsafe(method_family = none)]
697 pub unsafe fn registerObjectForStateRestoration_restorationIdentifier(
698 object: &ProtocolObject<dyn UIStateRestoring>,
699 restoration_identifier: &NSString,
700 );
701 );
702}
703
704#[repr(transparent)]
707#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
708pub struct UIApplicationCategory(pub NSInteger);
709impl UIApplicationCategory {
710 #[doc(alias = "UIApplicationCategoryWebBrowser")]
711 pub const WebBrowser: Self = Self(1);
712}
713
714unsafe impl Encode for UIApplicationCategory {
715 const ENCODING: Encoding = NSInteger::ENCODING;
716}
717
718unsafe impl RefEncode for UIApplicationCategory {
719 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
720}
721
722#[repr(transparent)]
727#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
728pub struct UIApplicationCategoryDefaultStatus(pub NSInteger);
729impl UIApplicationCategoryDefaultStatus {
730 #[doc(alias = "UIApplicationCategoryDefaultStatusUnavailable")]
732 pub const Unavailable: Self = Self(0);
733 #[doc(alias = "UIApplicationCategoryDefaultStatusIsDefault")]
735 pub const IsDefault: Self = Self(1);
736 #[doc(alias = "UIApplicationCategoryDefaultStatusNotDefault")]
738 pub const NotDefault: Self = Self(2);
739}
740
741unsafe impl Encode for UIApplicationCategoryDefaultStatus {
742 const ENCODING: Encoding = NSInteger::ENCODING;
743}
744
745unsafe impl RefEncode for UIApplicationCategoryDefaultStatus {
746 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
747}
748
749extern "C" {
750 pub static UIApplicationCategoryDefaultErrorDomain: &'static NSErrorDomain;
752}
753
754#[repr(transparent)]
757#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
758pub struct UIApplicationCategoryDefaultErrorCode(pub NSInteger);
759impl UIApplicationCategoryDefaultErrorCode {
760 #[doc(alias = "UIApplicationCategoryDefaultErrorRateLimited")]
762 pub const RateLimited: Self = Self(1);
763}
764
765unsafe impl Encode for UIApplicationCategoryDefaultErrorCode {
766 const ENCODING: Encoding = NSInteger::ENCODING;
767}
768
769unsafe impl RefEncode for UIApplicationCategoryDefaultErrorCode {
770 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
771}
772
773extern "C" {
774 pub static UIApplicationCategoryDefaultStatusLastProvidedDateErrorKey:
779 &'static NSErrorUserInfoKey;
780}
781
782extern "C" {
783 pub static UIApplicationCategoryDefaultRetryAvailabilityDateErrorKey:
788 &'static NSErrorUserInfoKey;
789}
790
791#[cfg(feature = "UIResponder")]
793impl UIApplication {
794 extern_methods!();
795}
796
797pub type UIApplicationLaunchOptionsKey = NSString;
800
801pub type UIApplicationOpenURLOptionsKey = NSString;
804
805pub type UIApplicationExtensionPointIdentifier = NSString;
808
809extern_protocol!(
810 pub unsafe trait UIApplicationDelegate: NSObjectProtocol + MainThreadOnly {
812 #[cfg(feature = "UIResponder")]
813 #[optional]
814 #[unsafe(method(applicationDidFinishLaunching:))]
815 #[unsafe(method_family = none)]
816 unsafe fn applicationDidFinishLaunching(&self, application: &UIApplication);
817
818 #[cfg(feature = "UIResponder")]
819 #[optional]
820 #[unsafe(method(application:willFinishLaunchingWithOptions:))]
821 #[unsafe(method_family = none)]
822 unsafe fn application_willFinishLaunchingWithOptions(
823 &self,
824 application: &UIApplication,
825 launch_options: Option<&NSDictionary<UIApplicationLaunchOptionsKey, AnyObject>>,
826 ) -> bool;
827
828 #[cfg(feature = "UIResponder")]
829 #[optional]
830 #[unsafe(method(application:didFinishLaunchingWithOptions:))]
831 #[unsafe(method_family = none)]
832 unsafe fn application_didFinishLaunchingWithOptions(
833 &self,
834 application: &UIApplication,
835 launch_options: Option<&NSDictionary<UIApplicationLaunchOptionsKey, AnyObject>>,
836 ) -> bool;
837
838 #[cfg(feature = "UIResponder")]
839 #[optional]
840 #[unsafe(method(applicationDidBecomeActive:))]
841 #[unsafe(method_family = none)]
842 unsafe fn applicationDidBecomeActive(&self, application: &UIApplication);
843
844 #[cfg(feature = "UIResponder")]
845 #[optional]
846 #[unsafe(method(applicationWillResignActive:))]
847 #[unsafe(method_family = none)]
848 unsafe fn applicationWillResignActive(&self, application: &UIApplication);
849
850 #[cfg(feature = "UIResponder")]
851 #[deprecated]
852 #[optional]
853 #[unsafe(method(application:handleOpenURL:))]
854 #[unsafe(method_family = none)]
855 unsafe fn application_handleOpenURL(
856 &self,
857 application: &UIApplication,
858 url: &NSURL,
859 ) -> bool;
860
861 #[cfg(feature = "UIResponder")]
862 #[deprecated]
863 #[optional]
864 #[unsafe(method(application:openURL:sourceApplication:annotation:))]
865 #[unsafe(method_family = none)]
866 unsafe fn application_openURL_sourceApplication_annotation(
867 &self,
868 application: &UIApplication,
869 url: &NSURL,
870 source_application: Option<&NSString>,
871 annotation: &AnyObject,
872 ) -> bool;
873
874 #[cfg(feature = "UIResponder")]
875 #[optional]
876 #[unsafe(method(application:openURL:options:))]
877 #[unsafe(method_family = none)]
878 unsafe fn application_openURL_options(
879 &self,
880 app: &UIApplication,
881 url: &NSURL,
882 options: &NSDictionary<UIApplicationOpenURLOptionsKey, AnyObject>,
883 ) -> bool;
884
885 #[cfg(feature = "UIResponder")]
886 #[optional]
887 #[unsafe(method(applicationDidReceiveMemoryWarning:))]
888 #[unsafe(method_family = none)]
889 unsafe fn applicationDidReceiveMemoryWarning(&self, application: &UIApplication);
890
891 #[cfg(feature = "UIResponder")]
892 #[optional]
893 #[unsafe(method(applicationWillTerminate:))]
894 #[unsafe(method_family = none)]
895 unsafe fn applicationWillTerminate(&self, application: &UIApplication);
896
897 #[cfg(feature = "UIResponder")]
898 #[optional]
899 #[unsafe(method(applicationSignificantTimeChange:))]
900 #[unsafe(method_family = none)]
901 unsafe fn applicationSignificantTimeChange(&self, application: &UIApplication);
902
903 #[cfg(all(feature = "UIOrientation", feature = "UIResponder"))]
904 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
905 #[optional]
906 #[unsafe(method(application:willChangeStatusBarOrientation:duration:))]
907 #[unsafe(method_family = none)]
908 unsafe fn application_willChangeStatusBarOrientation_duration(
909 &self,
910 application: &UIApplication,
911 new_status_bar_orientation: UIInterfaceOrientation,
912 duration: NSTimeInterval,
913 );
914
915 #[cfg(all(feature = "UIOrientation", feature = "UIResponder"))]
916 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
917 #[optional]
918 #[unsafe(method(application:didChangeStatusBarOrientation:))]
919 #[unsafe(method_family = none)]
920 unsafe fn application_didChangeStatusBarOrientation(
921 &self,
922 application: &UIApplication,
923 old_status_bar_orientation: UIInterfaceOrientation,
924 );
925
926 #[cfg(all(feature = "UIResponder", feature = "objc2-core-foundation"))]
927 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
928 #[optional]
929 #[unsafe(method(application:willChangeStatusBarFrame:))]
930 #[unsafe(method_family = none)]
931 unsafe fn application_willChangeStatusBarFrame(
932 &self,
933 application: &UIApplication,
934 new_status_bar_frame: CGRect,
935 );
936
937 #[cfg(all(feature = "UIResponder", feature = "objc2-core-foundation"))]
938 #[deprecated = "Use viewWillTransitionToSize:withTransitionCoordinator: instead."]
939 #[optional]
940 #[unsafe(method(application:didChangeStatusBarFrame:))]
941 #[unsafe(method_family = none)]
942 unsafe fn application_didChangeStatusBarFrame(
943 &self,
944 application: &UIApplication,
945 old_status_bar_frame: CGRect,
946 );
947
948 #[cfg(all(feature = "UIResponder", feature = "UIUserNotificationSettings"))]
949 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:]"]
950 #[optional]
951 #[unsafe(method(application:didRegisterUserNotificationSettings:))]
952 #[unsafe(method_family = none)]
953 unsafe fn application_didRegisterUserNotificationSettings(
954 &self,
955 application: &UIApplication,
956 notification_settings: &UIUserNotificationSettings,
957 );
958
959 #[cfg(feature = "UIResponder")]
960 #[optional]
961 #[unsafe(method(application:didRegisterForRemoteNotificationsWithDeviceToken:))]
962 #[unsafe(method_family = none)]
963 unsafe fn application_didRegisterForRemoteNotificationsWithDeviceToken(
964 &self,
965 application: &UIApplication,
966 device_token: &NSData,
967 );
968
969 #[cfg(feature = "UIResponder")]
970 #[optional]
971 #[unsafe(method(application:didFailToRegisterForRemoteNotificationsWithError:))]
972 #[unsafe(method_family = none)]
973 unsafe fn application_didFailToRegisterForRemoteNotificationsWithError(
974 &self,
975 application: &UIApplication,
976 error: &NSError,
977 );
978
979 #[cfg(feature = "UIResponder")]
980 #[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"]
981 #[optional]
982 #[unsafe(method(application:didReceiveRemoteNotification:))]
983 #[unsafe(method_family = none)]
984 unsafe fn application_didReceiveRemoteNotification(
985 &self,
986 application: &UIApplication,
987 user_info: &NSDictionary,
988 );
989
990 #[cfg(all(feature = "UILocalNotification", feature = "UIResponder"))]
991 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate willPresentNotification:withCompletionHandler:] or -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
992 #[optional]
993 #[unsafe(method(application:didReceiveLocalNotification:))]
994 #[unsafe(method_family = none)]
995 unsafe fn application_didReceiveLocalNotification(
996 &self,
997 application: &UIApplication,
998 notification: &UILocalNotification,
999 );
1000
1001 #[cfg(all(
1002 feature = "UILocalNotification",
1003 feature = "UIResponder",
1004 feature = "block2"
1005 ))]
1006 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1007 #[optional]
1008 #[unsafe(method(application:handleActionWithIdentifier:forLocalNotification:completionHandler:))]
1009 #[unsafe(method_family = none)]
1010 unsafe fn application_handleActionWithIdentifier_forLocalNotification_completionHandler(
1011 &self,
1012 application: &UIApplication,
1013 identifier: Option<&NSString>,
1014 notification: &UILocalNotification,
1015 completion_handler: &block2::DynBlock<dyn Fn()>,
1016 );
1017
1018 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1019 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1020 #[optional]
1021 #[unsafe(method(application:handleActionWithIdentifier:forRemoteNotification:withResponseInfo:completionHandler:))]
1022 #[unsafe(method_family = none)]
1023 unsafe fn application_handleActionWithIdentifier_forRemoteNotification_withResponseInfo_completionHandler(
1024 &self,
1025 application: &UIApplication,
1026 identifier: Option<&NSString>,
1027 user_info: &NSDictionary,
1028 response_info: &NSDictionary,
1029 completion_handler: &block2::DynBlock<dyn Fn()>,
1030 );
1031
1032 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1033 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1034 #[optional]
1035 #[unsafe(method(application:handleActionWithIdentifier:forRemoteNotification:completionHandler:))]
1036 #[unsafe(method_family = none)]
1037 unsafe fn application_handleActionWithIdentifier_forRemoteNotification_completionHandler(
1038 &self,
1039 application: &UIApplication,
1040 identifier: Option<&NSString>,
1041 user_info: &NSDictionary,
1042 completion_handler: &block2::DynBlock<dyn Fn()>,
1043 );
1044
1045 #[cfg(all(
1046 feature = "UILocalNotification",
1047 feature = "UIResponder",
1048 feature = "block2"
1049 ))]
1050 #[deprecated = "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]"]
1051 #[optional]
1052 #[unsafe(method(application:handleActionWithIdentifier:forLocalNotification:withResponseInfo:completionHandler:))]
1053 #[unsafe(method_family = none)]
1054 unsafe fn application_handleActionWithIdentifier_forLocalNotification_withResponseInfo_completionHandler(
1055 &self,
1056 application: &UIApplication,
1057 identifier: Option<&NSString>,
1058 notification: &UILocalNotification,
1059 response_info: &NSDictionary,
1060 completion_handler: &block2::DynBlock<dyn Fn()>,
1061 );
1062
1063 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1064 #[optional]
1068 #[unsafe(method(application:didReceiveRemoteNotification:fetchCompletionHandler:))]
1069 #[unsafe(method_family = none)]
1070 unsafe fn application_didReceiveRemoteNotification_fetchCompletionHandler(
1071 &self,
1072 application: &UIApplication,
1073 user_info: &NSDictionary,
1074 completion_handler: &block2::DynBlock<dyn Fn(UIBackgroundFetchResult)>,
1075 );
1076
1077 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1078 #[deprecated = "Use a BGAppRefreshTask in the BackgroundTasks framework instead"]
1080 #[optional]
1081 #[unsafe(method(application:performFetchWithCompletionHandler:))]
1082 #[unsafe(method_family = none)]
1083 unsafe fn application_performFetchWithCompletionHandler(
1084 &self,
1085 application: &UIApplication,
1086 completion_handler: &block2::DynBlock<dyn Fn(UIBackgroundFetchResult)>,
1087 );
1088
1089 #[cfg(all(
1090 feature = "UIApplicationShortcutItem",
1091 feature = "UIResponder",
1092 feature = "block2"
1093 ))]
1094 #[optional]
1095 #[unsafe(method(application:performActionForShortcutItem:completionHandler:))]
1096 #[unsafe(method_family = none)]
1097 unsafe fn application_performActionForShortcutItem_completionHandler(
1098 &self,
1099 application: &UIApplication,
1100 shortcut_item: &UIApplicationShortcutItem,
1101 completion_handler: &block2::DynBlock<dyn Fn(Bool)>,
1102 );
1103
1104 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1105 #[optional]
1106 #[unsafe(method(application:handleEventsForBackgroundURLSession:completionHandler:))]
1107 #[unsafe(method_family = none)]
1108 unsafe fn application_handleEventsForBackgroundURLSession_completionHandler(
1109 &self,
1110 application: &UIApplication,
1111 identifier: &NSString,
1112 completion_handler: &block2::DynBlock<dyn Fn()>,
1113 );
1114
1115 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1116 #[optional]
1117 #[unsafe(method(application:handleWatchKitExtensionRequest:reply:))]
1118 #[unsafe(method_family = none)]
1119 unsafe fn application_handleWatchKitExtensionRequest_reply(
1120 &self,
1121 application: &UIApplication,
1122 user_info: Option<&NSDictionary>,
1123 reply: &block2::DynBlock<dyn Fn(*mut NSDictionary)>,
1124 );
1125
1126 #[cfg(feature = "UIResponder")]
1127 #[optional]
1128 #[unsafe(method(applicationShouldRequestHealthAuthorization:))]
1129 #[unsafe(method_family = none)]
1130 unsafe fn applicationShouldRequestHealthAuthorization(&self, application: &UIApplication);
1131
1132 #[cfg(feature = "UIResponder")]
1133 #[optional]
1134 #[unsafe(method(applicationDidEnterBackground:))]
1135 #[unsafe(method_family = none)]
1136 unsafe fn applicationDidEnterBackground(&self, application: &UIApplication);
1137
1138 #[cfg(feature = "UIResponder")]
1139 #[optional]
1140 #[unsafe(method(applicationWillEnterForeground:))]
1141 #[unsafe(method_family = none)]
1142 unsafe fn applicationWillEnterForeground(&self, application: &UIApplication);
1143
1144 #[cfg(feature = "UIResponder")]
1145 #[optional]
1146 #[unsafe(method(applicationProtectedDataWillBecomeUnavailable:))]
1147 #[unsafe(method_family = none)]
1148 unsafe fn applicationProtectedDataWillBecomeUnavailable(&self, application: &UIApplication);
1149
1150 #[cfg(feature = "UIResponder")]
1151 #[optional]
1152 #[unsafe(method(applicationProtectedDataDidBecomeAvailable:))]
1153 #[unsafe(method_family = none)]
1154 unsafe fn applicationProtectedDataDidBecomeAvailable(&self, application: &UIApplication);
1155
1156 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
1157 #[optional]
1158 #[unsafe(method(window))]
1159 #[unsafe(method_family = none)]
1160 unsafe fn window(&self) -> Option<Retained<UIWindow>>;
1161
1162 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
1163 #[optional]
1165 #[unsafe(method(setWindow:))]
1166 #[unsafe(method_family = none)]
1167 unsafe fn setWindow(&self, window: Option<&UIWindow>);
1168
1169 #[cfg(all(
1170 feature = "UIOrientation",
1171 feature = "UIResponder",
1172 feature = "UIView",
1173 feature = "UIWindow"
1174 ))]
1175 #[optional]
1176 #[unsafe(method(application:supportedInterfaceOrientationsForWindow:))]
1177 #[unsafe(method_family = none)]
1178 unsafe fn application_supportedInterfaceOrientationsForWindow(
1179 &self,
1180 application: &UIApplication,
1181 window: Option<&UIWindow>,
1182 ) -> UIInterfaceOrientationMask;
1183
1184 #[cfg(feature = "UIResponder")]
1185 #[optional]
1186 #[unsafe(method(application:shouldAllowExtensionPointIdentifier:))]
1187 #[unsafe(method_family = none)]
1188 unsafe fn application_shouldAllowExtensionPointIdentifier(
1189 &self,
1190 application: &UIApplication,
1191 extension_point_identifier: &UIApplicationExtensionPointIdentifier,
1192 ) -> bool;
1193
1194 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
1195 #[optional]
1196 #[unsafe(method(application:viewControllerWithRestorationIdentifierPath:coder:))]
1197 #[unsafe(method_family = none)]
1198 unsafe fn application_viewControllerWithRestorationIdentifierPath_coder(
1199 &self,
1200 application: &UIApplication,
1201 identifier_components: &NSArray<NSString>,
1202 coder: &NSCoder,
1203 ) -> Option<Retained<UIViewController>>;
1204
1205 #[cfg(feature = "UIResponder")]
1206 #[optional]
1207 #[unsafe(method(application:shouldSaveSecureApplicationState:))]
1208 #[unsafe(method_family = none)]
1209 unsafe fn application_shouldSaveSecureApplicationState(
1210 &self,
1211 application: &UIApplication,
1212 coder: &NSCoder,
1213 ) -> bool;
1214
1215 #[cfg(feature = "UIResponder")]
1216 #[optional]
1217 #[unsafe(method(application:shouldRestoreSecureApplicationState:))]
1218 #[unsafe(method_family = none)]
1219 unsafe fn application_shouldRestoreSecureApplicationState(
1220 &self,
1221 application: &UIApplication,
1222 coder: &NSCoder,
1223 ) -> bool;
1224
1225 #[cfg(feature = "UIResponder")]
1226 #[optional]
1227 #[unsafe(method(application:willEncodeRestorableStateWithCoder:))]
1228 #[unsafe(method_family = none)]
1229 unsafe fn application_willEncodeRestorableStateWithCoder(
1230 &self,
1231 application: &UIApplication,
1232 coder: &NSCoder,
1233 );
1234
1235 #[cfg(feature = "UIResponder")]
1236 #[optional]
1237 #[unsafe(method(application:didDecodeRestorableStateWithCoder:))]
1238 #[unsafe(method_family = none)]
1239 unsafe fn application_didDecodeRestorableStateWithCoder(
1240 &self,
1241 application: &UIApplication,
1242 coder: &NSCoder,
1243 );
1244
1245 #[cfg(feature = "UIResponder")]
1246 #[deprecated = "Use application:shouldSaveSecureApplicationState: instead"]
1247 #[optional]
1248 #[unsafe(method(application:shouldSaveApplicationState:))]
1249 #[unsafe(method_family = none)]
1250 unsafe fn application_shouldSaveApplicationState(
1251 &self,
1252 application: &UIApplication,
1253 coder: &NSCoder,
1254 ) -> bool;
1255
1256 #[cfg(feature = "UIResponder")]
1257 #[deprecated = "Use application:shouldRestoreSecureApplicationState: instead"]
1258 #[optional]
1259 #[unsafe(method(application:shouldRestoreApplicationState:))]
1260 #[unsafe(method_family = none)]
1261 unsafe fn application_shouldRestoreApplicationState(
1262 &self,
1263 application: &UIApplication,
1264 coder: &NSCoder,
1265 ) -> bool;
1266
1267 #[cfg(feature = "UIResponder")]
1268 #[optional]
1269 #[unsafe(method(application:willContinueUserActivityWithType:))]
1270 #[unsafe(method_family = none)]
1271 unsafe fn application_willContinueUserActivityWithType(
1272 &self,
1273 application: &UIApplication,
1274 user_activity_type: &NSString,
1275 ) -> bool;
1276
1277 #[cfg(all(
1278 feature = "UIResponder",
1279 feature = "UIUserActivity",
1280 feature = "block2"
1281 ))]
1282 #[optional]
1283 #[unsafe(method(application:continueUserActivity:restorationHandler:))]
1284 #[unsafe(method_family = none)]
1285 unsafe fn application_continueUserActivity_restorationHandler(
1286 &self,
1287 application: &UIApplication,
1288 user_activity: &NSUserActivity,
1289 restoration_handler: &block2::DynBlock<
1290 dyn Fn(*mut NSArray<ProtocolObject<dyn UIUserActivityRestoring>>),
1291 >,
1292 ) -> bool;
1293
1294 #[cfg(feature = "UIResponder")]
1295 #[optional]
1296 #[unsafe(method(application:didFailToContinueUserActivityWithType:error:))]
1297 #[unsafe(method_family = none)]
1298 unsafe fn application_didFailToContinueUserActivityWithType_error(
1299 &self,
1300 application: &UIApplication,
1301 user_activity_type: &NSString,
1302 error: &NSError,
1303 );
1304
1305 #[cfg(feature = "UIResponder")]
1306 #[optional]
1307 #[unsafe(method(application:didUpdateUserActivity:))]
1308 #[unsafe(method_family = none)]
1309 unsafe fn application_didUpdateUserActivity(
1310 &self,
1311 application: &UIApplication,
1312 user_activity: &NSUserActivity,
1313 );
1314
1315 #[cfg(all(feature = "UIResponder", feature = "objc2-cloud-kit"))]
1316 #[optional]
1317 #[unsafe(method(application:userDidAcceptCloudKitShareWithMetadata:))]
1318 #[unsafe(method_family = none)]
1319 unsafe fn application_userDidAcceptCloudKitShareWithMetadata(
1320 &self,
1321 application: &UIApplication,
1322 cloud_kit_share_metadata: &CKShareMetadata,
1323 );
1324
1325 #[cfg(all(
1326 feature = "UIResponder",
1327 feature = "UISceneOptions",
1328 feature = "UISceneSession"
1329 ))]
1330 #[optional]
1331 #[unsafe(method(application:configurationForConnectingSceneSession:options:))]
1332 #[unsafe(method_family = none)]
1333 unsafe fn application_configurationForConnectingSceneSession_options(
1334 &self,
1335 application: &UIApplication,
1336 connecting_scene_session: &UISceneSession,
1337 options: &UISceneConnectionOptions,
1338 ) -> Retained<UISceneConfiguration>;
1339
1340 #[cfg(all(feature = "UIResponder", feature = "UISceneSession"))]
1341 #[optional]
1342 #[unsafe(method(application:didDiscardSceneSessions:))]
1343 #[unsafe(method_family = none)]
1344 unsafe fn application_didDiscardSceneSessions(
1345 &self,
1346 application: &UIApplication,
1347 scene_sessions: &NSSet<UISceneSession>,
1348 );
1349
1350 #[cfg(feature = "UIResponder")]
1351 #[optional]
1352 #[unsafe(method(applicationShouldAutomaticallyLocalizeKeyCommands:))]
1353 #[unsafe(method_family = none)]
1354 unsafe fn applicationShouldAutomaticallyLocalizeKeyCommands(
1355 &self,
1356 application: &UIApplication,
1357 ) -> bool;
1358 }
1359);
1360
1361#[cfg(feature = "UIResponder")]
1363impl UIApplication {
1364 extern_methods!(
1365 #[deprecated]
1366 #[unsafe(method(isProximitySensingEnabled))]
1367 #[unsafe(method_family = none)]
1368 pub unsafe fn isProximitySensingEnabled(&self) -> bool;
1369
1370 #[deprecated]
1372 #[unsafe(method(setProximitySensingEnabled:))]
1373 #[unsafe(method_family = none)]
1374 pub unsafe fn setProximitySensingEnabled(&self, proximity_sensing_enabled: bool);
1375
1376 #[deprecated = "Use -[UIViewController prefersStatusBarHidden]"]
1377 #[unsafe(method(setStatusBarHidden:animated:))]
1378 #[unsafe(method_family = none)]
1379 pub unsafe fn setStatusBarHidden_animated(&self, hidden: bool, animated: bool);
1380
1381 #[cfg(feature = "UIOrientation")]
1382 #[deprecated = "Explicit setting of the status bar orientation is more limited in iOS 6.0 and later"]
1384 #[unsafe(method(setStatusBarOrientation:))]
1385 #[unsafe(method_family = none)]
1386 pub unsafe fn setStatusBarOrientation(
1387 &self,
1388 status_bar_orientation: UIInterfaceOrientation,
1389 );
1390
1391 #[cfg(feature = "UIOrientation")]
1392 #[deprecated = "Explicit setting of the status bar orientation is more limited in iOS 6.0 and later"]
1393 #[unsafe(method(setStatusBarOrientation:animated:))]
1394 #[unsafe(method_family = none)]
1395 pub unsafe fn setStatusBarOrientation_animated(
1396 &self,
1397 interface_orientation: UIInterfaceOrientation,
1398 animated: bool,
1399 );
1400
1401 #[deprecated = "Use -[UIViewController preferredStatusBarStyle]"]
1403 #[unsafe(method(setStatusBarStyle:))]
1404 #[unsafe(method_family = none)]
1405 pub unsafe fn setStatusBarStyle(&self, status_bar_style: UIStatusBarStyle);
1406
1407 #[deprecated = "Use -[UIViewController preferredStatusBarStyle]"]
1408 #[unsafe(method(setStatusBarStyle:animated:))]
1409 #[unsafe(method_family = none)]
1410 pub unsafe fn setStatusBarStyle_animated(
1411 &self,
1412 status_bar_style: UIStatusBarStyle,
1413 animated: bool,
1414 );
1415
1416 #[deprecated = "Use -[UIViewController prefersStatusBarHidden]"]
1418 #[unsafe(method(setStatusBarHidden:))]
1419 #[unsafe(method_family = none)]
1420 pub unsafe fn setStatusBarHidden(&self, status_bar_hidden: bool);
1421
1422 #[deprecated = "Use -[UIViewController prefersStatusBarHidden]"]
1423 #[unsafe(method(setStatusBarHidden:withAnimation:))]
1424 #[unsafe(method_family = none)]
1425 pub unsafe fn setStatusBarHidden_withAnimation(
1426 &self,
1427 hidden: bool,
1428 animation: UIStatusBarAnimation,
1429 );
1430
1431 #[cfg(feature = "block2")]
1432 #[deprecated = "Please use PushKit for VoIP applications instead of calling this method"]
1433 #[unsafe(method(setKeepAliveTimeout:handler:))]
1434 #[unsafe(method_family = none)]
1435 pub unsafe fn setKeepAliveTimeout_handler(
1436 &self,
1437 timeout: NSTimeInterval,
1438 keep_alive_handler: Option<&block2::DynBlock<dyn Fn()>>,
1439 ) -> bool;
1440
1441 #[deprecated = "Please use PushKit for VoIP applications instead of calling this method"]
1442 #[unsafe(method(clearKeepAliveTimeout))]
1443 #[unsafe(method_family = none)]
1444 pub unsafe fn clearKeepAliveTimeout(&self);
1445 );
1446}
1447
1448#[cfg(feature = "UIResponder")]
1449impl UIApplication {
1450 #[doc(alias = "UIApplicationMain")]
1451 #[inline]
1452 pub(crate) unsafe fn __main(
1453 argc: c_int,
1454 argv: NonNull<*mut c_char>,
1455 principal_class_name: Option<&NSString>,
1456 delegate_class_name: Option<&NSString>,
1457 ) -> c_int {
1458 extern "C-unwind" {
1459 fn UIApplicationMain(
1460 argc: c_int,
1461 argv: NonNull<*mut c_char>,
1462 principal_class_name: Option<&NSString>,
1463 delegate_class_name: Option<&NSString>,
1464 ) -> c_int;
1465 }
1466 unsafe { UIApplicationMain(argc, argv, principal_class_name, delegate_class_name) }
1467 }
1468}
1469
1470extern "C" {
1471 pub static UITrackingRunLoopMode: &'static NSRunLoopMode;
1473}
1474
1475extern "C" {
1476 pub static UIApplicationDidEnterBackgroundNotification: &'static NSNotificationName;
1478}
1479
1480extern "C" {
1481 pub static UIApplicationWillEnterForegroundNotification: &'static NSNotificationName;
1483}
1484
1485extern "C" {
1486 pub static UIApplicationDidFinishLaunchingNotification: &'static NSNotificationName;
1488}
1489
1490extern "C" {
1491 pub static UIApplicationDidBecomeActiveNotification: &'static NSNotificationName;
1493}
1494
1495extern "C" {
1496 pub static UIApplicationWillResignActiveNotification: &'static NSNotificationName;
1498}
1499
1500extern "C" {
1501 pub static UIApplicationDidReceiveMemoryWarningNotification: &'static NSNotificationName;
1503}
1504
1505extern "C" {
1506 pub static UIApplicationWillTerminateNotification: &'static NSNotificationName;
1508}
1509
1510extern "C" {
1511 pub static UIApplicationSignificantTimeChangeNotification: &'static NSNotificationName;
1513}
1514
1515extern "C" {
1516 pub static UIApplicationWillChangeStatusBarOrientationNotification: &'static NSNotificationName;
1518}
1519
1520extern "C" {
1521 pub static UIApplicationDidChangeStatusBarOrientationNotification: &'static NSNotificationName;
1523}
1524
1525extern "C" {
1526 pub static UIApplicationStatusBarOrientationUserInfoKey: &'static NSString;
1528}
1529
1530extern "C" {
1531 pub static UIApplicationWillChangeStatusBarFrameNotification: &'static NSNotificationName;
1533}
1534
1535extern "C" {
1536 pub static UIApplicationDidChangeStatusBarFrameNotification: &'static NSNotificationName;
1538}
1539
1540extern "C" {
1541 pub static UIApplicationStatusBarFrameUserInfoKey: &'static NSString;
1543}
1544
1545extern "C" {
1546 pub static UIApplicationBackgroundRefreshStatusDidChangeNotification:
1548 &'static NSNotificationName;
1549}
1550
1551extern "C" {
1552 pub static UIApplicationProtectedDataWillBecomeUnavailable: &'static NSNotificationName;
1554}
1555
1556extern "C" {
1557 pub static UIApplicationProtectedDataDidBecomeAvailable: &'static NSNotificationName;
1559}
1560
1561extern "C" {
1562 pub static UIApplicationLaunchOptionsURLKey: &'static UIApplicationLaunchOptionsKey;
1564}
1565
1566extern "C" {
1567 pub static UIApplicationLaunchOptionsSourceApplicationKey:
1569 &'static UIApplicationLaunchOptionsKey;
1570}
1571
1572extern "C" {
1573 pub static UIApplicationLaunchOptionsRemoteNotificationKey:
1575 &'static UIApplicationLaunchOptionsKey;
1576}
1577
1578extern "C" {
1579 pub static UIApplicationLaunchOptionsLocalNotificationKey:
1581 &'static UIApplicationLaunchOptionsKey;
1582}
1583
1584extern "C" {
1585 pub static UIApplicationLaunchOptionsAnnotationKey: &'static UIApplicationLaunchOptionsKey;
1587}
1588
1589extern "C" {
1590 pub static UIApplicationLaunchOptionsLocationKey: &'static UIApplicationLaunchOptionsKey;
1592}
1593
1594extern "C" {
1595 pub static UIApplicationLaunchOptionsNewsstandDownloadsKey:
1597 &'static UIApplicationLaunchOptionsKey;
1598}
1599
1600extern "C" {
1601 pub static UIApplicationLaunchOptionsBluetoothCentralsKey:
1603 &'static UIApplicationLaunchOptionsKey;
1604}
1605
1606extern "C" {
1607 pub static UIApplicationLaunchOptionsBluetoothPeripheralsKey:
1609 &'static UIApplicationLaunchOptionsKey;
1610}
1611
1612extern "C" {
1613 pub static UIApplicationLaunchOptionsShortcutItemKey: &'static UIApplicationLaunchOptionsKey;
1615}
1616
1617extern "C" {
1618 pub static UIApplicationLaunchOptionsEventAttributionKey:
1620 &'static UIApplicationLaunchOptionsKey;
1621}
1622
1623extern "C" {
1624 pub static UIApplicationLaunchOptionsUserActivityDictionaryKey:
1626 &'static UIApplicationLaunchOptionsKey;
1627}
1628
1629extern "C" {
1630 pub static UIApplicationLaunchOptionsUserActivityTypeKey:
1632 &'static UIApplicationLaunchOptionsKey;
1633}
1634
1635extern "C" {
1636 pub static UIApplicationLaunchOptionsCloudKitShareMetadataKey:
1638 &'static UIApplicationLaunchOptionsKey;
1639}
1640
1641extern "C" {
1642 pub static UIApplicationOpenSettingsURLString: &'static NSString;
1644}
1645
1646extern "C" {
1647 pub static UIApplicationOpenDefaultApplicationsSettingsURLString: &'static NSString;
1651}
1652
1653extern "C" {
1654 pub static UIApplicationOpenNotificationSettingsURLString: &'static NSString;
1656}
1657
1658extern "C" {
1659 pub static UIApplicationOpenURLOptionsSourceApplicationKey:
1661 &'static UIApplicationOpenURLOptionsKey;
1662}
1663
1664extern "C" {
1665 pub static UIApplicationOpenURLOptionsAnnotationKey: &'static UIApplicationOpenURLOptionsKey;
1667}
1668
1669extern "C" {
1670 pub static UIApplicationOpenURLOptionsOpenInPlaceKey: &'static UIApplicationOpenURLOptionsKey;
1672}
1673
1674extern "C" {
1675 pub static UIApplicationOpenURLOptionsEventAttributionKey:
1677 &'static UIApplicationOpenURLOptionsKey;
1678}
1679
1680extern "C" {
1681 pub static UIApplicationUserDidTakeScreenshotNotification: &'static NSNotificationName;
1683}
1684
1685extern "C" {
1686 pub static UIApplicationKeyboardExtensionPointIdentifier:
1688 &'static UIApplicationExtensionPointIdentifier;
1689}
1690
1691extern "C" {
1692 pub static UIApplicationOpenURLOptionUniversalLinksOnly:
1694 &'static UIApplicationOpenExternalURLOptionsKey;
1695}
1696
1697extern "C" {
1698 pub static UIApplicationOpenExternalURLOptionsEventAttributionKey:
1700 &'static UIApplicationOpenExternalURLOptionsKey;
1701}
1702
1703extern "C-unwind" {
1704 #[deprecated = "renamed to `UIApplication::__main`"]
1705 pub fn UIApplicationMain(
1706 argc: c_int,
1707 argv: NonNull<*mut c_char>,
1708 principal_class_name: Option<&NSString>,
1709 delegate_class_name: Option<&NSString>,
1710 ) -> c_int;
1711}