1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIModalTransitionStyle(pub NSInteger);
17impl UIModalTransitionStyle {
18 #[doc(alias = "UIModalTransitionStyleCoverVertical")]
19 pub const CoverVertical: Self = Self(0);
20 #[doc(alias = "UIModalTransitionStyleFlipHorizontal")]
21 pub const FlipHorizontal: Self = Self(1);
22 #[doc(alias = "UIModalTransitionStyleCrossDissolve")]
23 pub const CrossDissolve: Self = Self(2);
24 #[doc(alias = "UIModalTransitionStylePartialCurl")]
25 pub const PartialCurl: Self = Self(3);
26}
27
28unsafe impl Encode for UIModalTransitionStyle {
29 const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32unsafe impl RefEncode for UIModalTransitionStyle {
33 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36#[repr(transparent)]
39#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
40pub struct UIModalPresentationStyle(pub NSInteger);
41impl UIModalPresentationStyle {
42 #[doc(alias = "UIModalPresentationFullScreen")]
43 pub const FullScreen: Self = Self(0);
44 #[doc(alias = "UIModalPresentationPageSheet")]
45 pub const PageSheet: Self = Self(1);
46 #[doc(alias = "UIModalPresentationFormSheet")]
47 pub const FormSheet: Self = Self(2);
48 #[doc(alias = "UIModalPresentationCurrentContext")]
49 pub const CurrentContext: Self = Self(3);
50 #[doc(alias = "UIModalPresentationCustom")]
51 pub const Custom: Self = Self(4);
52 #[doc(alias = "UIModalPresentationOverFullScreen")]
53 pub const OverFullScreen: Self = Self(5);
54 #[doc(alias = "UIModalPresentationOverCurrentContext")]
55 pub const OverCurrentContext: Self = Self(6);
56 #[doc(alias = "UIModalPresentationPopover")]
57 pub const Popover: Self = Self(7);
58 #[doc(alias = "UIModalPresentationBlurOverFullScreen")]
59 pub const BlurOverFullScreen: Self = Self(8);
60 #[doc(alias = "UIModalPresentationNone")]
61 pub const None: Self = Self(-1);
62 #[doc(alias = "UIModalPresentationAutomatic")]
63 pub const Automatic: Self = Self(-2);
64}
65
66unsafe impl Encode for UIModalPresentationStyle {
67 const ENCODING: Encoding = NSInteger::ENCODING;
68}
69
70unsafe impl RefEncode for UIModalPresentationStyle {
71 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
72}
73
74extern_protocol!(
75 pub unsafe trait UIContentContainer: NSObjectProtocol + MainThreadOnly {
77 #[cfg(feature = "objc2-core-foundation")]
78 #[unsafe(method(preferredContentSize))]
79 #[unsafe(method_family = none)]
80 unsafe fn preferredContentSize(&self) -> CGSize;
81
82 #[unsafe(method(preferredContentSizeDidChangeForChildContentContainer:))]
83 #[unsafe(method_family = none)]
84 unsafe fn preferredContentSizeDidChangeForChildContentContainer(
85 &self,
86 container: &ProtocolObject<dyn UIContentContainer>,
87 );
88
89 #[unsafe(method(systemLayoutFittingSizeDidChangeForChildContentContainer:))]
90 #[unsafe(method_family = none)]
91 unsafe fn systemLayoutFittingSizeDidChangeForChildContentContainer(
92 &self,
93 container: &ProtocolObject<dyn UIContentContainer>,
94 );
95
96 #[cfg(feature = "objc2-core-foundation")]
97 #[unsafe(method(sizeForChildContentContainer:withParentContainerSize:))]
98 #[unsafe(method_family = none)]
99 unsafe fn sizeForChildContentContainer_withParentContainerSize(
100 &self,
101 container: &ProtocolObject<dyn UIContentContainer>,
102 parent_size: CGSize,
103 ) -> CGSize;
104
105 #[cfg(all(
106 feature = "UIViewControllerTransitionCoordinator",
107 feature = "objc2-core-foundation"
108 ))]
109 #[unsafe(method(viewWillTransitionToSize:withTransitionCoordinator:))]
110 #[unsafe(method_family = none)]
111 unsafe fn viewWillTransitionToSize_withTransitionCoordinator(
112 &self,
113 size: CGSize,
114 coordinator: &ProtocolObject<dyn UIViewControllerTransitionCoordinator>,
115 );
116
117 #[cfg(all(
118 feature = "UITraitCollection",
119 feature = "UIViewControllerTransitionCoordinator"
120 ))]
121 #[unsafe(method(willTransitionToTraitCollection:withTransitionCoordinator:))]
122 #[unsafe(method_family = none)]
123 unsafe fn willTransitionToTraitCollection_withTransitionCoordinator(
124 &self,
125 new_collection: &UITraitCollection,
126 coordinator: &ProtocolObject<dyn UIViewControllerTransitionCoordinator>,
127 );
128 }
129);
130
131extern "C" {
132 pub static UIViewControllerShowDetailTargetDidChangeNotification: &'static NSNotificationName;
134}
135
136extern_class!(
137 #[unsafe(super(UIResponder, NSObject))]
139 #[thread_kind = MainThreadOnly]
140 #[derive(Debug, PartialEq, Eq, Hash)]
141 #[cfg(feature = "UIResponder")]
142 pub struct UIViewController;
143);
144
145#[cfg(feature = "UIResponder")]
146unsafe impl NSCoding for UIViewController {}
147
148#[cfg(feature = "UIResponder")]
149unsafe impl NSObjectProtocol for UIViewController {}
150
151#[cfg(all(feature = "UIAppearance", feature = "UIResponder"))]
152unsafe impl UIAppearanceContainer for UIViewController {}
153
154#[cfg(feature = "UIResponder")]
155unsafe impl UIContentContainer for UIViewController {}
156
157#[cfg(all(feature = "UIFocus", feature = "UIResponder"))]
158unsafe impl UIFocusEnvironment for UIViewController {}
159
160#[cfg(feature = "UIResponder")]
161unsafe impl UIResponderStandardEditActions for UIViewController {}
162
163#[cfg(all(feature = "UIResponder", feature = "UITraitCollection"))]
164unsafe impl UITraitEnvironment for UIViewController {}
165
166#[cfg(feature = "UIResponder")]
167impl UIViewController {
168 extern_methods!(
169 #[unsafe(method(initWithNibName:bundle:))]
170 #[unsafe(method_family = init)]
171 pub unsafe fn initWithNibName_bundle(
172 this: Allocated<Self>,
173 nib_name_or_nil: Option<&NSString>,
174 nib_bundle_or_nil: Option<&NSBundle>,
175 ) -> Retained<Self>;
176
177 #[unsafe(method(initWithCoder:))]
178 #[unsafe(method_family = init)]
179 pub unsafe fn initWithCoder(
180 this: Allocated<Self>,
181 coder: &NSCoder,
182 ) -> Option<Retained<Self>>;
183
184 #[cfg(feature = "UIView")]
185 #[unsafe(method(view))]
186 #[unsafe(method_family = none)]
187 pub fn view(&self) -> Option<Retained<UIView>>;
188
189 #[cfg(feature = "UIView")]
190 #[unsafe(method(setView:))]
192 #[unsafe(method_family = none)]
193 pub fn setView(&self, view: Option<&UIView>);
194
195 #[unsafe(method(loadView))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn loadView(&self);
198
199 #[unsafe(method(loadViewIfNeeded))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn loadViewIfNeeded(&self);
202
203 #[cfg(feature = "UIView")]
204 #[unsafe(method(viewIfLoaded))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn viewIfLoaded(&self) -> Option<Retained<UIView>>;
207
208 #[deprecated]
209 #[unsafe(method(viewWillUnload))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn viewWillUnload(&self);
212
213 #[deprecated]
214 #[unsafe(method(viewDidUnload))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn viewDidUnload(&self);
217
218 #[unsafe(method(viewDidLoad))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn viewDidLoad(&self);
221
222 #[unsafe(method(isViewLoaded))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn isViewLoaded(&self) -> bool;
225
226 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
227 #[unsafe(method(nibName))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn nibName(&self) -> Option<Retained<NSString>>;
230
231 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
232 #[unsafe(method(nibBundle))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn nibBundle(&self) -> Option<Retained<NSBundle>>;
235
236 #[cfg(feature = "UIStoryboard")]
237 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
238 #[unsafe(method(storyboard))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn storyboard(&self) -> Option<Retained<UIStoryboard>>;
241
242 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
243 #[unsafe(method(performSegueWithIdentifier:sender:))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn performSegueWithIdentifier_sender(
246 &self,
247 identifier: &NSString,
248 sender: Option<&AnyObject>,
249 );
250
251 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
252 #[unsafe(method(shouldPerformSegueWithIdentifier:sender:))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn shouldPerformSegueWithIdentifier_sender(
255 &self,
256 identifier: &NSString,
257 sender: Option<&AnyObject>,
258 ) -> bool;
259
260 #[cfg(feature = "UIStoryboardSegue")]
261 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
262 #[unsafe(method(prepareForSegue:sender:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn prepareForSegue_sender(
265 &self,
266 segue: &UIStoryboardSegue,
267 sender: Option<&AnyObject>,
268 );
269
270 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
271 #[unsafe(method(canPerformUnwindSegueAction:fromViewController:sender:))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn canPerformUnwindSegueAction_fromViewController_sender(
274 &self,
275 action: Sel,
276 from_view_controller: &UIViewController,
277 sender: Option<&AnyObject>,
278 ) -> bool;
279
280 #[deprecated]
281 #[unsafe(method(canPerformUnwindSegueAction:fromViewController:withSender:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn canPerformUnwindSegueAction_fromViewController_withSender(
284 &self,
285 action: Sel,
286 from_view_controller: &UIViewController,
287 sender: &AnyObject,
288 ) -> bool;
289
290 #[cfg(feature = "UIStoryboardSegue")]
291 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
292 #[unsafe(method(allowedChildViewControllersForUnwindingFromSource:))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn allowedChildViewControllersForUnwindingFromSource(
295 &self,
296 source: &UIStoryboardUnwindSegueSource,
297 ) -> Retained<NSArray<UIViewController>>;
298
299 #[cfg(feature = "UIStoryboardSegue")]
300 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
301 #[unsafe(method(childViewControllerContainingSegueSource:))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn childViewControllerContainingSegueSource(
304 &self,
305 source: &UIStoryboardUnwindSegueSource,
306 ) -> Option<Retained<UIViewController>>;
307
308 #[deprecated]
309 #[unsafe(method(viewControllerForUnwindSegueAction:fromViewController:withSender:))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn viewControllerForUnwindSegueAction_fromViewController_withSender(
312 &self,
313 action: Sel,
314 from_view_controller: &UIViewController,
315 sender: Option<&AnyObject>,
316 ) -> Option<Retained<UIViewController>>;
317
318 #[cfg(feature = "UIStoryboardSegue")]
319 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
320 #[unsafe(method(unwindForSegue:towardsViewController:))]
321 #[unsafe(method_family = none)]
322 pub unsafe fn unwindForSegue_towardsViewController(
323 &self,
324 unwind_segue: &UIStoryboardSegue,
325 subsequent_vc: &UIViewController,
326 );
327
328 #[cfg(feature = "UIStoryboardSegue")]
329 #[deprecated]
330 #[unsafe(method(segueForUnwindingToViewController:fromViewController:identifier:))]
331 #[unsafe(method_family = none)]
332 pub unsafe fn segueForUnwindingToViewController_fromViewController_identifier(
333 &self,
334 to_view_controller: &UIViewController,
335 from_view_controller: &UIViewController,
336 identifier: Option<&NSString>,
337 ) -> Option<Retained<UIStoryboardSegue>>;
338
339 #[unsafe(method(viewWillAppear:))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn viewWillAppear(&self, animated: bool);
350
351 #[unsafe(method(viewIsAppearing:))]
363 #[unsafe(method_family = none)]
364 pub unsafe fn viewIsAppearing(&self, animated: bool);
365
366 #[unsafe(method(viewDidAppear:))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn viewDidAppear(&self, animated: bool);
370
371 #[unsafe(method(viewWillDisappear:))]
373 #[unsafe(method_family = none)]
374 pub unsafe fn viewWillDisappear(&self, animated: bool);
375
376 #[unsafe(method(viewDidDisappear:))]
378 #[unsafe(method_family = none)]
379 pub unsafe fn viewDidDisappear(&self, animated: bool);
380
381 #[unsafe(method(viewWillLayoutSubviews))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn viewWillLayoutSubviews(&self);
384
385 #[unsafe(method(viewDidLayoutSubviews))]
386 #[unsafe(method_family = none)]
387 pub unsafe fn viewDidLayoutSubviews(&self);
388
389 #[unsafe(method(title))]
390 #[unsafe(method_family = none)]
391 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
392
393 #[unsafe(method(setTitle:))]
395 #[unsafe(method_family = none)]
396 pub unsafe fn setTitle(&self, title: Option<&NSString>);
397
398 #[unsafe(method(didReceiveMemoryWarning))]
399 #[unsafe(method_family = none)]
400 pub unsafe fn didReceiveMemoryWarning(&self);
401
402 #[unsafe(method(parentViewController))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn parentViewController(&self) -> Option<Retained<UIViewController>>;
405
406 #[deprecated]
407 #[unsafe(method(modalViewController))]
408 #[unsafe(method_family = none)]
409 pub unsafe fn modalViewController(&self) -> Option<Retained<UIViewController>>;
410
411 #[unsafe(method(presentedViewController))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn presentedViewController(&self) -> Option<Retained<UIViewController>>;
414
415 #[unsafe(method(presentingViewController))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn presentingViewController(&self) -> Option<Retained<UIViewController>>;
418
419 #[unsafe(method(definesPresentationContext))]
420 #[unsafe(method_family = none)]
421 pub unsafe fn definesPresentationContext(&self) -> bool;
422
423 #[unsafe(method(setDefinesPresentationContext:))]
425 #[unsafe(method_family = none)]
426 pub unsafe fn setDefinesPresentationContext(&self, defines_presentation_context: bool);
427
428 #[unsafe(method(providesPresentationContextTransitionStyle))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn providesPresentationContextTransitionStyle(&self) -> bool;
431
432 #[unsafe(method(setProvidesPresentationContextTransitionStyle:))]
434 #[unsafe(method_family = none)]
435 pub unsafe fn setProvidesPresentationContextTransitionStyle(
436 &self,
437 provides_presentation_context_transition_style: bool,
438 );
439
440 #[unsafe(method(restoresFocusAfterTransition))]
441 #[unsafe(method_family = none)]
442 pub unsafe fn restoresFocusAfterTransition(&self) -> bool;
443
444 #[unsafe(method(setRestoresFocusAfterTransition:))]
446 #[unsafe(method_family = none)]
447 pub unsafe fn setRestoresFocusAfterTransition(&self, restores_focus_after_transition: bool);
448
449 #[unsafe(method(focusGroupIdentifier))]
451 #[unsafe(method_family = none)]
452 pub unsafe fn focusGroupIdentifier(&self) -> Option<Retained<NSString>>;
453
454 #[unsafe(method(setFocusGroupIdentifier:))]
456 #[unsafe(method_family = none)]
457 pub unsafe fn setFocusGroupIdentifier(&self, focus_group_identifier: Option<&NSString>);
458
459 #[unsafe(method(interactionActivityTrackingBaseName))]
461 #[unsafe(method_family = none)]
462 pub unsafe fn interactionActivityTrackingBaseName(&self) -> Option<Retained<NSString>>;
463
464 #[unsafe(method(setInteractionActivityTrackingBaseName:))]
466 #[unsafe(method_family = none)]
467 pub unsafe fn setInteractionActivityTrackingBaseName(
468 &self,
469 interaction_activity_tracking_base_name: Option<&NSString>,
470 );
471
472 #[unsafe(method(isBeingPresented))]
473 #[unsafe(method_family = none)]
474 pub unsafe fn isBeingPresented(&self) -> bool;
475
476 #[unsafe(method(isBeingDismissed))]
477 #[unsafe(method_family = none)]
478 pub unsafe fn isBeingDismissed(&self) -> bool;
479
480 #[unsafe(method(isMovingToParentViewController))]
481 #[unsafe(method_family = none)]
482 pub unsafe fn isMovingToParentViewController(&self) -> bool;
483
484 #[unsafe(method(isMovingFromParentViewController))]
485 #[unsafe(method_family = none)]
486 pub unsafe fn isMovingFromParentViewController(&self) -> bool;
487
488 #[cfg(feature = "block2")]
489 #[unsafe(method(presentViewController:animated:completion:))]
490 #[unsafe(method_family = none)]
491 pub unsafe fn presentViewController_animated_completion(
492 &self,
493 view_controller_to_present: &UIViewController,
494 flag: bool,
495 completion: Option<&block2::Block<dyn Fn()>>,
496 );
497
498 #[cfg(feature = "block2")]
499 #[unsafe(method(dismissViewControllerAnimated:completion:))]
500 #[unsafe(method_family = none)]
501 pub unsafe fn dismissViewControllerAnimated_completion(
502 &self,
503 flag: bool,
504 completion: Option<&block2::Block<dyn Fn()>>,
505 );
506
507 #[deprecated]
508 #[unsafe(method(presentModalViewController:animated:))]
509 #[unsafe(method_family = none)]
510 pub unsafe fn presentModalViewController_animated(
511 &self,
512 modal_view_controller: &UIViewController,
513 animated: bool,
514 );
515
516 #[deprecated]
517 #[unsafe(method(dismissModalViewControllerAnimated:))]
518 #[unsafe(method_family = none)]
519 pub unsafe fn dismissModalViewControllerAnimated(&self, animated: bool);
520
521 #[unsafe(method(modalTransitionStyle))]
522 #[unsafe(method_family = none)]
523 pub unsafe fn modalTransitionStyle(&self) -> UIModalTransitionStyle;
524
525 #[unsafe(method(setModalTransitionStyle:))]
527 #[unsafe(method_family = none)]
528 pub unsafe fn setModalTransitionStyle(
529 &self,
530 modal_transition_style: UIModalTransitionStyle,
531 );
532
533 #[cfg(feature = "UIViewControllerTransition")]
534 #[unsafe(method(preferredTransition))]
540 #[unsafe(method_family = none)]
541 pub unsafe fn preferredTransition(&self) -> Option<Retained<UIViewControllerTransition>>;
542
543 #[cfg(feature = "UIViewControllerTransition")]
544 #[unsafe(method(setPreferredTransition:))]
546 #[unsafe(method_family = none)]
547 pub unsafe fn setPreferredTransition(
548 &self,
549 preferred_transition: Option<&UIViewControllerTransition>,
550 );
551
552 #[unsafe(method(modalPresentationStyle))]
553 #[unsafe(method_family = none)]
554 pub unsafe fn modalPresentationStyle(&self) -> UIModalPresentationStyle;
555
556 #[unsafe(method(setModalPresentationStyle:))]
558 #[unsafe(method_family = none)]
559 pub unsafe fn setModalPresentationStyle(
560 &self,
561 modal_presentation_style: UIModalPresentationStyle,
562 );
563
564 #[unsafe(method(modalPresentationCapturesStatusBarAppearance))]
565 #[unsafe(method_family = none)]
566 pub unsafe fn modalPresentationCapturesStatusBarAppearance(&self) -> bool;
567
568 #[unsafe(method(setModalPresentationCapturesStatusBarAppearance:))]
570 #[unsafe(method_family = none)]
571 pub unsafe fn setModalPresentationCapturesStatusBarAppearance(
572 &self,
573 modal_presentation_captures_status_bar_appearance: bool,
574 );
575
576 #[unsafe(method(disablesAutomaticKeyboardDismissal))]
577 #[unsafe(method_family = none)]
578 pub unsafe fn disablesAutomaticKeyboardDismissal(&self) -> bool;
579
580 #[deprecated]
581 #[unsafe(method(wantsFullScreenLayout))]
582 #[unsafe(method_family = none)]
583 pub unsafe fn wantsFullScreenLayout(&self) -> bool;
584
585 #[deprecated]
587 #[unsafe(method(setWantsFullScreenLayout:))]
588 #[unsafe(method_family = none)]
589 pub unsafe fn setWantsFullScreenLayout(&self, wants_full_screen_layout: bool);
590
591 #[cfg(feature = "UIGeometry")]
592 #[unsafe(method(edgesForExtendedLayout))]
593 #[unsafe(method_family = none)]
594 pub unsafe fn edgesForExtendedLayout(&self) -> UIRectEdge;
595
596 #[cfg(feature = "UIGeometry")]
597 #[unsafe(method(setEdgesForExtendedLayout:))]
599 #[unsafe(method_family = none)]
600 pub unsafe fn setEdgesForExtendedLayout(&self, edges_for_extended_layout: UIRectEdge);
601
602 #[unsafe(method(extendedLayoutIncludesOpaqueBars))]
603 #[unsafe(method_family = none)]
604 pub unsafe fn extendedLayoutIncludesOpaqueBars(&self) -> bool;
605
606 #[unsafe(method(setExtendedLayoutIncludesOpaqueBars:))]
608 #[unsafe(method_family = none)]
609 pub unsafe fn setExtendedLayoutIncludesOpaqueBars(
610 &self,
611 extended_layout_includes_opaque_bars: bool,
612 );
613
614 #[deprecated = "Use UIScrollView's contentInsetAdjustmentBehavior instead"]
615 #[unsafe(method(automaticallyAdjustsScrollViewInsets))]
616 #[unsafe(method_family = none)]
617 pub unsafe fn automaticallyAdjustsScrollViewInsets(&self) -> bool;
618
619 #[deprecated = "Use UIScrollView's contentInsetAdjustmentBehavior instead"]
621 #[unsafe(method(setAutomaticallyAdjustsScrollViewInsets:))]
622 #[unsafe(method_family = none)]
623 pub unsafe fn setAutomaticallyAdjustsScrollViewInsets(
624 &self,
625 automatically_adjusts_scroll_view_insets: bool,
626 );
627
628 #[cfg(all(feature = "UIGeometry", feature = "UIScrollView", feature = "UIView"))]
629 #[unsafe(method(setContentScrollView:forEdge:))]
631 #[unsafe(method_family = none)]
632 pub unsafe fn setContentScrollView_forEdge(
633 &self,
634 scroll_view: Option<&UIScrollView>,
635 edge: NSDirectionalRectEdge,
636 );
637
638 #[cfg(all(feature = "UIGeometry", feature = "UIScrollView", feature = "UIView"))]
639 #[unsafe(method(contentScrollViewForEdge:))]
641 #[unsafe(method_family = none)]
642 pub unsafe fn contentScrollViewForEdge(
643 &self,
644 edge: NSDirectionalRectEdge,
645 ) -> Option<Retained<UIScrollView>>;
646
647 #[cfg(feature = "objc2-core-foundation")]
648 #[unsafe(method(preferredContentSize))]
649 #[unsafe(method_family = none)]
650 pub unsafe fn preferredContentSize(&self) -> CGSize;
651
652 #[cfg(feature = "objc2-core-foundation")]
653 #[unsafe(method(setPreferredContentSize:))]
655 #[unsafe(method_family = none)]
656 pub unsafe fn setPreferredContentSize(&self, preferred_content_size: CGSize);
657
658 #[cfg(feature = "UIApplication")]
659 #[deprecated = "Has no effect on visionOS"]
660 #[unsafe(method(preferredStatusBarStyle))]
661 #[unsafe(method_family = none)]
662 pub unsafe fn preferredStatusBarStyle(&self) -> UIStatusBarStyle;
663
664 #[deprecated = "Has no effect on visionOS"]
665 #[unsafe(method(prefersStatusBarHidden))]
666 #[unsafe(method_family = none)]
667 pub unsafe fn prefersStatusBarHidden(&self) -> bool;
668
669 #[cfg(feature = "UIApplication")]
670 #[deprecated = "Has no effect on visionOS"]
671 #[unsafe(method(preferredStatusBarUpdateAnimation))]
672 #[unsafe(method_family = none)]
673 pub unsafe fn preferredStatusBarUpdateAnimation(&self) -> UIStatusBarAnimation;
674
675 #[unsafe(method(setNeedsStatusBarAppearanceUpdate))]
676 #[unsafe(method_family = none)]
677 pub fn setNeedsStatusBarAppearanceUpdate(&self);
678
679 #[unsafe(method(targetViewControllerForAction:sender:))]
680 #[unsafe(method_family = none)]
681 pub unsafe fn targetViewControllerForAction_sender(
682 &self,
683 action: Sel,
684 sender: Option<&AnyObject>,
685 ) -> Option<Retained<UIViewController>>;
686
687 #[unsafe(method(showViewController:sender:))]
688 #[unsafe(method_family = none)]
689 pub unsafe fn showViewController_sender(
690 &self,
691 vc: &UIViewController,
692 sender: Option<&AnyObject>,
693 );
694
695 #[unsafe(method(showDetailViewController:sender:))]
696 #[unsafe(method_family = none)]
697 pub unsafe fn showDetailViewController_sender(
698 &self,
699 vc: &UIViewController,
700 sender: Option<&AnyObject>,
701 );
702
703 #[cfg(feature = "UIInterface")]
704 #[unsafe(method(preferredUserInterfaceStyle))]
705 #[unsafe(method_family = none)]
706 pub unsafe fn preferredUserInterfaceStyle(&self) -> UIUserInterfaceStyle;
707
708 #[unsafe(method(setNeedsUserInterfaceAppearanceUpdate))]
709 #[unsafe(method_family = none)]
710 pub unsafe fn setNeedsUserInterfaceAppearanceUpdate(&self);
711
712 #[cfg(feature = "UIInterface")]
713 #[unsafe(method(overrideUserInterfaceStyle))]
714 #[unsafe(method_family = none)]
715 pub unsafe fn overrideUserInterfaceStyle(&self) -> UIUserInterfaceStyle;
716
717 #[cfg(feature = "UIInterface")]
718 #[unsafe(method(setOverrideUserInterfaceStyle:))]
720 #[unsafe(method_family = none)]
721 pub unsafe fn setOverrideUserInterfaceStyle(
722 &self,
723 override_user_interface_style: UIUserInterfaceStyle,
724 );
725 );
726}
727
728#[cfg(feature = "UIResponder")]
730impl UIViewController {
731 extern_methods!(
732 #[unsafe(method(init))]
733 #[unsafe(method_family = init)]
734 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
735
736 #[unsafe(method(new))]
737 #[unsafe(method_family = new)]
738 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
739 );
740}
741
742#[cfg(feature = "UIResponder")]
744impl UIViewController {
745 extern_methods!(
746 #[deprecated = "Please use instance method `setNeedsUpdateOfSupportedInterfaceOrientations`."]
747 #[unsafe(method(attemptRotationToDeviceOrientation))]
748 #[unsafe(method_family = none)]
749 pub fn attemptRotationToDeviceOrientation(mtm: MainThreadMarker);
750
751 #[cfg(feature = "UIOrientation")]
752 #[deprecated]
753 #[unsafe(method(shouldAutorotateToInterfaceOrientation:))]
754 #[unsafe(method_family = none)]
755 pub unsafe fn shouldAutorotateToInterfaceOrientation(
756 &self,
757 to_interface_orientation: UIInterfaceOrientation,
758 ) -> bool;
759
760 #[deprecated = "Update supported interface orientations and call setNeedsUpdateOfSupportedInterfaceOrientations to indicate a change."]
761 #[unsafe(method(shouldAutorotate))]
762 #[unsafe(method_family = none)]
763 pub unsafe fn shouldAutorotate(&self) -> bool;
764
765 #[cfg(feature = "UIOrientation")]
766 #[unsafe(method(supportedInterfaceOrientations))]
767 #[unsafe(method_family = none)]
768 pub unsafe fn supportedInterfaceOrientations(&self) -> UIInterfaceOrientationMask;
769
770 #[cfg(feature = "UIOrientation")]
771 #[unsafe(method(preferredInterfaceOrientationForPresentation))]
772 #[unsafe(method_family = none)]
773 pub unsafe fn preferredInterfaceOrientationForPresentation(&self)
774 -> UIInterfaceOrientation;
775
776 #[unsafe(method(setNeedsUpdateOfSupportedInterfaceOrientations))]
779 #[unsafe(method_family = none)]
780 pub unsafe fn setNeedsUpdateOfSupportedInterfaceOrientations(&self);
781
782 #[cfg(feature = "UIView")]
783 #[deprecated = "Header views are animated along with the rest of the view hierarchy"]
784 #[unsafe(method(rotatingHeaderView))]
785 #[unsafe(method_family = none)]
786 pub unsafe fn rotatingHeaderView(&self) -> Option<Retained<UIView>>;
787
788 #[cfg(feature = "UIView")]
789 #[deprecated = "Footer views are animated along with the rest of the view hierarchy"]
790 #[unsafe(method(rotatingFooterView))]
791 #[unsafe(method_family = none)]
792 pub unsafe fn rotatingFooterView(&self) -> Option<Retained<UIView>>;
793
794 #[cfg(feature = "UIOrientation")]
795 #[deprecated]
796 #[unsafe(method(interfaceOrientation))]
797 #[unsafe(method_family = none)]
798 pub unsafe fn interfaceOrientation(&self) -> UIInterfaceOrientation;
799
800 #[cfg(feature = "UIOrientation")]
801 #[deprecated = "Implement viewWillTransitionToSize:withTransitionCoordinator: instead"]
802 #[unsafe(method(willRotateToInterfaceOrientation:duration:))]
803 #[unsafe(method_family = none)]
804 pub unsafe fn willRotateToInterfaceOrientation_duration(
805 &self,
806 to_interface_orientation: UIInterfaceOrientation,
807 duration: NSTimeInterval,
808 );
809
810 #[cfg(feature = "UIOrientation")]
811 #[deprecated]
812 #[unsafe(method(didRotateFromInterfaceOrientation:))]
813 #[unsafe(method_family = none)]
814 pub unsafe fn didRotateFromInterfaceOrientation(
815 &self,
816 from_interface_orientation: UIInterfaceOrientation,
817 );
818
819 #[cfg(feature = "UIOrientation")]
820 #[deprecated = "Implement viewWillTransitionToSize:withTransitionCoordinator: instead"]
821 #[unsafe(method(willAnimateRotationToInterfaceOrientation:duration:))]
822 #[unsafe(method_family = none)]
823 pub unsafe fn willAnimateRotationToInterfaceOrientation_duration(
824 &self,
825 to_interface_orientation: UIInterfaceOrientation,
826 duration: NSTimeInterval,
827 );
828
829 #[cfg(feature = "UIOrientation")]
830 #[deprecated]
831 #[unsafe(method(willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:))]
832 #[unsafe(method_family = none)]
833 pub unsafe fn willAnimateFirstHalfOfRotationToInterfaceOrientation_duration(
834 &self,
835 to_interface_orientation: UIInterfaceOrientation,
836 duration: NSTimeInterval,
837 );
838
839 #[cfg(feature = "UIOrientation")]
840 #[deprecated]
841 #[unsafe(method(didAnimateFirstHalfOfRotationToInterfaceOrientation:))]
842 #[unsafe(method_family = none)]
843 pub unsafe fn didAnimateFirstHalfOfRotationToInterfaceOrientation(
844 &self,
845 to_interface_orientation: UIInterfaceOrientation,
846 );
847
848 #[cfg(feature = "UIOrientation")]
849 #[deprecated]
850 #[unsafe(method(willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:))]
851 #[unsafe(method_family = none)]
852 pub unsafe fn willAnimateSecondHalfOfRotationFromInterfaceOrientation_duration(
853 &self,
854 from_interface_orientation: UIInterfaceOrientation,
855 duration: NSTimeInterval,
856 );
857 );
858}
859
860#[cfg(feature = "UIResponder")]
862impl UIViewController {
863 extern_methods!(
864 #[unsafe(method(isEditing))]
865 #[unsafe(method_family = none)]
866 pub unsafe fn isEditing(&self) -> bool;
867
868 #[unsafe(method(setEditing:))]
870 #[unsafe(method_family = none)]
871 pub unsafe fn setEditing(&self, editing: bool);
872
873 #[unsafe(method(setEditing:animated:))]
874 #[unsafe(method_family = none)]
875 pub unsafe fn setEditing_animated(&self, editing: bool, animated: bool);
876
877 #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
878 #[unsafe(method(editButtonItem))]
879 #[unsafe(method_family = none)]
880 pub unsafe fn editButtonItem(&self) -> Retained<UIBarButtonItem>;
881 );
882}
883
884#[cfg(feature = "UIResponder")]
886impl UIViewController {
887 extern_methods!(
888 #[cfg(feature = "UISearchDisplayController")]
889 #[deprecated]
890 #[unsafe(method(searchDisplayController))]
891 #[unsafe(method_family = none)]
892 pub unsafe fn searchDisplayController(&self)
893 -> Option<Retained<UISearchDisplayController>>;
894 );
895}
896
897extern "C" {
898 pub static UIViewControllerHierarchyInconsistencyException: &'static NSExceptionName;
900}
901
902#[cfg(feature = "UIResponder")]
904impl UIViewController {
905 extern_methods!(
906 #[unsafe(method(childViewControllers))]
907 #[unsafe(method_family = none)]
908 pub unsafe fn childViewControllers(&self) -> Retained<NSArray<UIViewController>>;
909
910 #[unsafe(method(addChildViewController:))]
911 #[unsafe(method_family = none)]
912 pub unsafe fn addChildViewController(&self, child_controller: &UIViewController);
913
914 #[unsafe(method(removeFromParentViewController))]
915 #[unsafe(method_family = none)]
916 pub unsafe fn removeFromParentViewController(&self);
917
918 #[cfg(all(feature = "UIView", feature = "block2"))]
919 #[unsafe(method(transitionFromViewController:toViewController:duration:options:animations:completion:))]
920 #[unsafe(method_family = none)]
921 pub unsafe fn transitionFromViewController_toViewController_duration_options_animations_completion(
922 &self,
923 from_view_controller: &UIViewController,
924 to_view_controller: &UIViewController,
925 duration: NSTimeInterval,
926 options: UIViewAnimationOptions,
927 animations: Option<&block2::Block<dyn Fn()>>,
928 completion: Option<&block2::Block<dyn Fn(Bool)>>,
929 );
930
931 #[unsafe(method(beginAppearanceTransition:animated:))]
932 #[unsafe(method_family = none)]
933 pub unsafe fn beginAppearanceTransition_animated(&self, is_appearing: bool, animated: bool);
934
935 #[unsafe(method(endAppearanceTransition))]
936 #[unsafe(method_family = none)]
937 pub unsafe fn endAppearanceTransition(&self);
938
939 #[deprecated = "Has no effect on visionOS"]
940 #[unsafe(method(childViewControllerForStatusBarStyle))]
941 #[unsafe(method_family = none)]
942 pub unsafe fn childViewControllerForStatusBarStyle(
943 &self,
944 ) -> Option<Retained<UIViewController>>;
945
946 #[deprecated = "Has no effect on visionOS"]
947 #[unsafe(method(childViewControllerForStatusBarHidden))]
948 #[unsafe(method_family = none)]
949 pub unsafe fn childViewControllerForStatusBarHidden(
950 &self,
951 ) -> Option<Retained<UIViewController>>;
952
953 #[cfg(feature = "UITraitCollection")]
954 #[deprecated = "Use the traitOverrides property on the child view controller instead"]
955 #[unsafe(method(setOverrideTraitCollection:forChildViewController:))]
956 #[unsafe(method_family = none)]
957 pub unsafe fn setOverrideTraitCollection_forChildViewController(
958 &self,
959 collection: Option<&UITraitCollection>,
960 child_view_controller: &UIViewController,
961 );
962
963 #[cfg(feature = "UITraitCollection")]
964 #[deprecated = "Use the traitOverrides property on the child view controller instead"]
965 #[unsafe(method(overrideTraitCollectionForChildViewController:))]
966 #[unsafe(method_family = none)]
967 pub unsafe fn overrideTraitCollectionForChildViewController(
968 &self,
969 child_view_controller: &UIViewController,
970 ) -> Option<Retained<UITraitCollection>>;
971
972 #[unsafe(method(childViewControllerForUserInterfaceStyle))]
973 #[unsafe(method_family = none)]
974 pub unsafe fn childViewControllerForUserInterfaceStyle(
975 &self,
976 ) -> Option<Retained<UIViewController>>;
977 );
978}
979
980#[cfg(feature = "UIResponder")]
982impl UIViewController {
983 extern_methods!(
984 #[deprecated]
985 #[unsafe(method(automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers))]
986 #[unsafe(method_family = none)]
987 pub unsafe fn automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers(
988 &self,
989 ) -> bool;
990
991 #[deprecated = "Manually forward viewWillTransitionToSize:withTransitionCoordinator: if necessary"]
992 #[unsafe(method(shouldAutomaticallyForwardRotationMethods))]
993 #[unsafe(method_family = none)]
994 pub unsafe fn shouldAutomaticallyForwardRotationMethods(&self) -> bool;
995
996 #[unsafe(method(shouldAutomaticallyForwardAppearanceMethods))]
997 #[unsafe(method_family = none)]
998 pub unsafe fn shouldAutomaticallyForwardAppearanceMethods(&self) -> bool;
999
1000 #[unsafe(method(willMoveToParentViewController:))]
1001 #[unsafe(method_family = none)]
1002 pub unsafe fn willMoveToParentViewController(&self, parent: Option<&UIViewController>);
1003
1004 #[unsafe(method(didMoveToParentViewController:))]
1005 #[unsafe(method_family = none)]
1006 pub unsafe fn didMoveToParentViewController(&self, parent: Option<&UIViewController>);
1007 );
1008}
1009
1010#[cfg(feature = "UIResponder")]
1012impl UIViewController {
1013 extern_methods!(
1014 #[unsafe(method(restorationIdentifier))]
1015 #[unsafe(method_family = none)]
1016 pub unsafe fn restorationIdentifier(&self) -> Option<Retained<NSString>>;
1017
1018 #[unsafe(method(setRestorationIdentifier:))]
1020 #[unsafe(method_family = none)]
1021 pub unsafe fn setRestorationIdentifier(&self, restoration_identifier: Option<&NSString>);
1022
1023 #[cfg(feature = "UIStateRestoration")]
1024 #[unsafe(method(restorationClass))]
1025 #[unsafe(method_family = none)]
1026 pub unsafe fn restorationClass(&self) -> Option<&'static AnyClass>;
1027
1028 #[cfg(feature = "UIStateRestoration")]
1029 #[unsafe(method(setRestorationClass:))]
1031 #[unsafe(method_family = none)]
1032 pub unsafe fn setRestorationClass(&self, restoration_class: Option<&AnyClass>);
1033
1034 #[unsafe(method(encodeRestorableStateWithCoder:))]
1035 #[unsafe(method_family = none)]
1036 pub unsafe fn encodeRestorableStateWithCoder(&self, coder: &NSCoder);
1037
1038 #[unsafe(method(decodeRestorableStateWithCoder:))]
1039 #[unsafe(method_family = none)]
1040 pub unsafe fn decodeRestorableStateWithCoder(&self, coder: &NSCoder);
1041
1042 #[unsafe(method(applicationFinishedRestoringState))]
1043 #[unsafe(method_family = none)]
1044 pub unsafe fn applicationFinishedRestoringState(&self);
1045 );
1046}
1047
1048#[cfg(all(feature = "UIResponder", feature = "UIStateRestoration"))]
1049unsafe impl UIStateRestoring for UIViewController {}
1050
1051#[cfg(feature = "UIResponder")]
1053impl UIViewController {
1054 extern_methods!(
1055 #[unsafe(method(updateViewConstraints))]
1056 #[unsafe(method_family = none)]
1057 pub unsafe fn updateViewConstraints(&self);
1058 );
1059}
1060
1061#[cfg(feature = "UIResponder")]
1063impl UIViewController {
1064 extern_methods!(
1065 #[cfg(feature = "UIViewControllerTransitioning")]
1066 #[unsafe(method(transitioningDelegate))]
1067 #[unsafe(method_family = none)]
1068 pub unsafe fn transitioningDelegate(
1069 &self,
1070 ) -> Option<Retained<ProtocolObject<dyn UIViewControllerTransitioningDelegate>>>;
1071
1072 #[cfg(feature = "UIViewControllerTransitioning")]
1073 #[unsafe(method(setTransitioningDelegate:))]
1076 #[unsafe(method_family = none)]
1077 pub unsafe fn setTransitioningDelegate(
1078 &self,
1079 transitioning_delegate: Option<
1080 &ProtocolObject<dyn UIViewControllerTransitioningDelegate>,
1081 >,
1082 );
1083 );
1084}
1085
1086#[cfg(feature = "UIResponder")]
1088impl UIViewController {
1089 extern_methods!(
1090 #[cfg(feature = "NSLayoutConstraint")]
1091 #[deprecated = "Use view.safeAreaLayoutGuide.topAnchor instead of topLayoutGuide.bottomAnchor"]
1092 #[unsafe(method(topLayoutGuide))]
1093 #[unsafe(method_family = none)]
1094 pub unsafe fn topLayoutGuide(&self) -> Retained<ProtocolObject<dyn UILayoutSupport>>;
1095
1096 #[cfg(feature = "NSLayoutConstraint")]
1097 #[deprecated = "Use view.safeAreaLayoutGuide.bottomAnchor instead of bottomLayoutGuide.topAnchor"]
1098 #[unsafe(method(bottomLayoutGuide))]
1099 #[unsafe(method_family = none)]
1100 pub unsafe fn bottomLayoutGuide(&self) -> Retained<ProtocolObject<dyn UILayoutSupport>>;
1101
1102 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1103 #[unsafe(method(additionalSafeAreaInsets))]
1104 #[unsafe(method_family = none)]
1105 pub unsafe fn additionalSafeAreaInsets(&self) -> UIEdgeInsets;
1106
1107 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1108 #[unsafe(method(setAdditionalSafeAreaInsets:))]
1110 #[unsafe(method_family = none)]
1111 pub unsafe fn setAdditionalSafeAreaInsets(&self, additional_safe_area_insets: UIEdgeInsets);
1112
1113 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1114 #[unsafe(method(systemMinimumLayoutMargins))]
1115 #[unsafe(method_family = none)]
1116 pub unsafe fn systemMinimumLayoutMargins(&self) -> NSDirectionalEdgeInsets;
1117
1118 #[unsafe(method(viewRespectsSystemMinimumLayoutMargins))]
1119 #[unsafe(method_family = none)]
1120 pub unsafe fn viewRespectsSystemMinimumLayoutMargins(&self) -> bool;
1121
1122 #[unsafe(method(setViewRespectsSystemMinimumLayoutMargins:))]
1124 #[unsafe(method_family = none)]
1125 pub unsafe fn setViewRespectsSystemMinimumLayoutMargins(
1126 &self,
1127 view_respects_system_minimum_layout_margins: bool,
1128 );
1129
1130 #[unsafe(method(viewLayoutMarginsDidChange))]
1131 #[unsafe(method_family = none)]
1132 pub unsafe fn viewLayoutMarginsDidChange(&self);
1133
1134 #[unsafe(method(viewSafeAreaInsetsDidChange))]
1135 #[unsafe(method_family = none)]
1136 pub unsafe fn viewSafeAreaInsetsDidChange(&self);
1137 );
1138}
1139
1140#[cfg(feature = "UIResponder")]
1142impl UIViewController {
1143 extern_methods!(
1144 #[cfg(all(
1145 feature = "UICommand",
1146 feature = "UIKeyCommand",
1147 feature = "UIMenuElement"
1148 ))]
1149 #[unsafe(method(addKeyCommand:))]
1150 #[unsafe(method_family = none)]
1151 pub unsafe fn addKeyCommand(&self, key_command: &UIKeyCommand);
1152
1153 #[cfg(all(
1154 feature = "UICommand",
1155 feature = "UIKeyCommand",
1156 feature = "UIMenuElement"
1157 ))]
1158 #[unsafe(method(removeKeyCommand:))]
1159 #[unsafe(method_family = none)]
1160 pub unsafe fn removeKeyCommand(&self, key_command: &UIKeyCommand);
1161 );
1162}
1163
1164#[cfg(feature = "UIResponder")]
1166impl UIViewController {
1167 extern_methods!(
1168 #[unsafe(method(performsActionsWhilePresentingModally))]
1172 #[unsafe(method_family = none)]
1173 pub unsafe fn performsActionsWhilePresentingModally(&self) -> bool;
1174 );
1175}
1176
1177#[cfg(feature = "UIResponder")]
1179impl UIViewController {
1180 extern_methods!(
1181 #[unsafe(method(extensionContext))]
1182 #[unsafe(method_family = none)]
1183 pub unsafe fn extensionContext(&self) -> Option<Retained<NSExtensionContext>>;
1184 );
1185}
1186
1187#[cfg(feature = "UIResponder")]
1188unsafe impl NSExtensionRequestHandling for UIViewController {}
1189
1190#[cfg(feature = "UIResponder")]
1192impl UIViewController {
1193 extern_methods!(
1194 #[cfg(feature = "UIPresentationController")]
1195 #[unsafe(method(presentationController))]
1196 #[unsafe(method_family = none)]
1197 pub unsafe fn presentationController(&self) -> Option<Retained<UIPresentationController>>;
1198
1199 #[cfg(all(
1200 feature = "UIPresentationController",
1201 feature = "UISheetPresentationController"
1202 ))]
1203 #[unsafe(method(sheetPresentationController))]
1204 #[unsafe(method_family = none)]
1205 pub unsafe fn sheetPresentationController(
1206 &self,
1207 ) -> Option<Retained<UISheetPresentationController>>;
1208
1209 #[cfg(all(
1210 feature = "UIPopoverPresentationController",
1211 feature = "UIPresentationController"
1212 ))]
1213 #[unsafe(method(popoverPresentationController))]
1214 #[unsafe(method_family = none)]
1215 pub unsafe fn popoverPresentationController(
1216 &self,
1217 ) -> Option<Retained<UIPopoverPresentationController>>;
1218
1219 #[cfg(feature = "UIPresentationController")]
1220 #[unsafe(method(activePresentationController))]
1221 #[unsafe(method_family = none)]
1222 pub unsafe fn activePresentationController(
1223 &self,
1224 ) -> Option<Retained<UIPresentationController>>;
1225
1226 #[unsafe(method(isModalInPresentation))]
1227 #[unsafe(method_family = none)]
1228 pub unsafe fn isModalInPresentation(&self) -> bool;
1229
1230 #[unsafe(method(setModalInPresentation:))]
1232 #[unsafe(method_family = none)]
1233 pub unsafe fn setModalInPresentation(&self, modal_in_presentation: bool);
1234 );
1235}
1236
1237extern_protocol!(
1238 pub unsafe trait UIViewControllerPreviewing: NSObjectProtocol + MainThreadOnly {
1240 #[cfg(feature = "UIGestureRecognizer")]
1241 #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1242 #[unsafe(method(previewingGestureRecognizerForFailureRelationship))]
1243 #[unsafe(method_family = none)]
1244 unsafe fn previewingGestureRecognizerForFailureRelationship(
1245 &self,
1246 ) -> Retained<UIGestureRecognizer>;
1247
1248 #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1249 #[unsafe(method(delegate))]
1250 #[unsafe(method_family = none)]
1251 unsafe fn delegate(
1252 &self,
1253 ) -> Retained<ProtocolObject<dyn UIViewControllerPreviewingDelegate>>;
1254
1255 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
1256 #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1257 #[unsafe(method(sourceView))]
1258 #[unsafe(method_family = none)]
1259 unsafe fn sourceView(&self) -> Retained<UIView>;
1260
1261 #[cfg(feature = "objc2-core-foundation")]
1262 #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1263 #[unsafe(method(sourceRect))]
1264 #[unsafe(method_family = none)]
1265 unsafe fn sourceRect(&self) -> CGRect;
1266
1267 #[cfg(feature = "objc2-core-foundation")]
1268 #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1270 #[unsafe(method(setSourceRect:))]
1271 #[unsafe(method_family = none)]
1272 unsafe fn setSourceRect(&self, source_rect: CGRect);
1273 }
1274);
1275
1276extern_protocol!(
1277 pub unsafe trait UIViewControllerPreviewingDelegate:
1279 NSObjectProtocol + MainThreadOnly
1280 {
1281 #[cfg(all(feature = "UIResponder", feature = "objc2-core-foundation"))]
1282 #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1283 #[unsafe(method(previewingContext:viewControllerForLocation:))]
1284 #[unsafe(method_family = none)]
1285 unsafe fn previewingContext_viewControllerForLocation(
1286 &self,
1287 previewing_context: &ProtocolObject<dyn UIViewControllerPreviewing>,
1288 location: CGPoint,
1289 ) -> Option<Retained<UIViewController>>;
1290
1291 #[cfg(feature = "UIResponder")]
1292 #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1293 #[unsafe(method(previewingContext:commitViewController:))]
1294 #[unsafe(method_family = none)]
1295 unsafe fn previewingContext_commitViewController(
1296 &self,
1297 previewing_context: &ProtocolObject<dyn UIViewControllerPreviewing>,
1298 view_controller_to_commit: &UIViewController,
1299 );
1300 }
1301);
1302
1303#[cfg(feature = "UIResponder")]
1305impl UIViewController {
1306 extern_methods!(
1307 #[cfg(feature = "UIView")]
1308 #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1309 #[unsafe(method(registerForPreviewingWithDelegate:sourceView:))]
1310 #[unsafe(method_family = none)]
1311 pub unsafe fn registerForPreviewingWithDelegate_sourceView(
1312 &self,
1313 delegate: &ProtocolObject<dyn UIViewControllerPreviewingDelegate>,
1314 source_view: &UIView,
1315 ) -> Retained<ProtocolObject<dyn UIViewControllerPreviewing>>;
1316
1317 #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1318 #[unsafe(method(unregisterForPreviewingWithContext:))]
1319 #[unsafe(method_family = none)]
1320 pub unsafe fn unregisterForPreviewingWithContext(
1321 &self,
1322 previewing: &ProtocolObject<dyn UIViewControllerPreviewing>,
1323 );
1324 );
1325}
1326
1327#[cfg(feature = "UIResponder")]
1329impl UIViewController {
1330 extern_methods!(
1331 #[unsafe(method(childViewControllerForScreenEdgesDeferringSystemGestures))]
1332 #[unsafe(method_family = none)]
1333 pub unsafe fn childViewControllerForScreenEdgesDeferringSystemGestures(
1334 &self,
1335 ) -> Option<Retained<UIViewController>>;
1336
1337 #[cfg(feature = "UIGeometry")]
1338 #[unsafe(method(preferredScreenEdgesDeferringSystemGestures))]
1339 #[unsafe(method_family = none)]
1340 pub unsafe fn preferredScreenEdgesDeferringSystemGestures(&self) -> UIRectEdge;
1341
1342 #[unsafe(method(setNeedsUpdateOfScreenEdgesDeferringSystemGestures))]
1343 #[unsafe(method_family = none)]
1344 pub fn setNeedsUpdateOfScreenEdgesDeferringSystemGestures(&self);
1345 );
1346}
1347
1348#[cfg(feature = "UIResponder")]
1350impl UIViewController {
1351 extern_methods!(
1352 #[unsafe(method(childViewControllerForHomeIndicatorAutoHidden))]
1353 #[unsafe(method_family = none)]
1354 pub unsafe fn childViewControllerForHomeIndicatorAutoHidden(
1355 &self,
1356 ) -> Option<Retained<UIViewController>>;
1357
1358 #[unsafe(method(prefersHomeIndicatorAutoHidden))]
1359 #[unsafe(method_family = none)]
1360 pub unsafe fn prefersHomeIndicatorAutoHidden(&self) -> bool;
1361
1362 #[unsafe(method(setNeedsUpdateOfHomeIndicatorAutoHidden))]
1363 #[unsafe(method_family = none)]
1364 pub fn setNeedsUpdateOfHomeIndicatorAutoHidden(&self);
1365 );
1366}
1367
1368#[cfg(feature = "UIResponder")]
1370impl UIViewController {
1371 extern_methods!(
1372 #[unsafe(method(childViewControllerForPointerLock))]
1373 #[unsafe(method_family = none)]
1374 pub unsafe fn childViewControllerForPointerLock(
1375 &self,
1376 ) -> Option<Retained<UIViewController>>;
1377
1378 #[unsafe(method(prefersPointerLocked))]
1379 #[unsafe(method_family = none)]
1380 pub unsafe fn prefersPointerLocked(&self) -> bool;
1381
1382 #[unsafe(method(setNeedsUpdateOfPrefersPointerLocked))]
1383 #[unsafe(method_family = none)]
1384 pub unsafe fn setNeedsUpdateOfPrefersPointerLocked(&self);
1385 );
1386}
1387
1388#[cfg(feature = "UIResponder")]
1389impl UIViewController {
1390 extern_methods!(
1391 #[cfg(feature = "UIContentConfiguration")]
1392 #[unsafe(method(contentUnavailableConfiguration))]
1396 #[unsafe(method_family = none)]
1397 pub unsafe fn contentUnavailableConfiguration(
1398 &self,
1399 ) -> Option<Retained<ProtocolObject<dyn UIContentConfiguration>>>;
1400
1401 #[cfg(feature = "UIContentConfiguration")]
1402 #[unsafe(method(setContentUnavailableConfiguration:))]
1404 #[unsafe(method_family = none)]
1405 pub unsafe fn setContentUnavailableConfiguration(
1406 &self,
1407 content_unavailable_configuration: Option<&ProtocolObject<dyn UIContentConfiguration>>,
1408 );
1409
1410 #[cfg(feature = "UIContentUnavailableConfigurationState")]
1411 #[unsafe(method(contentUnavailableConfigurationState))]
1415 #[unsafe(method_family = none)]
1416 pub unsafe fn contentUnavailableConfigurationState(
1417 &self,
1418 ) -> Retained<UIContentUnavailableConfigurationState>;
1419
1420 #[unsafe(method(setNeedsUpdateContentUnavailableConfiguration))]
1424 #[unsafe(method_family = none)]
1425 pub unsafe fn setNeedsUpdateContentUnavailableConfiguration(&self);
1426
1427 #[cfg(feature = "UIContentUnavailableConfigurationState")]
1428 #[unsafe(method(updateContentUnavailableConfigurationUsingState:))]
1431 #[unsafe(method_family = none)]
1432 pub unsafe fn updateContentUnavailableConfigurationUsingState(
1433 &self,
1434 state: &UIContentUnavailableConfigurationState,
1435 );
1436 );
1437}
1438
1439#[cfg(feature = "UIResponder")]
1440impl UIViewController {
1441 extern_methods!(
1442 #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1443 #[unsafe(method(previewActionItems))]
1444 #[unsafe(method_family = none)]
1445 pub unsafe fn previewActionItems(
1446 &self,
1447 ) -> Retained<NSArray<ProtocolObject<dyn UIPreviewActionItem>>>;
1448 );
1449}
1450
1451#[cfg(feature = "UIResponder")]
1452impl UIViewController {
1453 extern_methods!(
1454 #[cfg(feature = "UITraitCollection")]
1455 #[unsafe(method(traitOverrides))]
1456 #[unsafe(method_family = none)]
1457 pub unsafe fn traitOverrides(&self) -> Retained<ProtocolObject<dyn UITraitOverrides>>;
1458
1459 #[unsafe(method(updateTraitsIfNeeded))]
1462 #[unsafe(method_family = none)]
1463 pub unsafe fn updateTraitsIfNeeded(&self);
1464 );
1465}
1466
1467#[cfg(all(feature = "UIResponder", feature = "UITraitCollection"))]
1468unsafe impl UITraitChangeObservable for UIViewController {}
1469
1470#[repr(transparent)]
1473#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1474pub struct UIContainerBackgroundStyle(pub NSInteger);
1475impl UIContainerBackgroundStyle {
1476 #[doc(alias = "UIContainerBackgroundStyleAutomatic")]
1477 pub const Automatic: Self = Self(0);
1478 #[doc(alias = "UIContainerBackgroundStyleGlass")]
1479 pub const Glass: Self = Self(1);
1480 #[doc(alias = "UIContainerBackgroundStyleHidden")]
1481 pub const Hidden: Self = Self(2);
1482}
1483
1484unsafe impl Encode for UIContainerBackgroundStyle {
1485 const ENCODING: Encoding = NSInteger::ENCODING;
1486}
1487
1488unsafe impl RefEncode for UIContainerBackgroundStyle {
1489 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1490}
1491
1492#[cfg(feature = "UIResponder")]
1493impl UIViewController {
1494 extern_methods!(
1495 #[unsafe(method(preferredContainerBackgroundStyle))]
1496 #[unsafe(method_family = none)]
1497 pub unsafe fn preferredContainerBackgroundStyle(&self) -> UIContainerBackgroundStyle;
1498
1499 #[unsafe(method(childViewControllerForPreferredContainerBackgroundStyle))]
1500 #[unsafe(method_family = none)]
1501 pub unsafe fn childViewControllerForPreferredContainerBackgroundStyle(
1502 &self,
1503 ) -> Option<Retained<UIViewController>>;
1504
1505 #[unsafe(method(setNeedsUpdateOfPreferredContainerBackgroundStyle))]
1506 #[unsafe(method_family = none)]
1507 pub unsafe fn setNeedsUpdateOfPreferredContainerBackgroundStyle(&self);
1508 );
1509}
1510
1511extern_protocol!(
1512 pub unsafe trait UIPreviewActionItem: NSObjectProtocol + MainThreadOnly {
1514 #[unsafe(method(title))]
1515 #[unsafe(method_family = none)]
1516 unsafe fn title(&self) -> Retained<NSString>;
1517 }
1518);
1519
1520#[deprecated = "Please use UIContextMenuInteraction."]
1523#[repr(transparent)]
1524#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1525pub struct UIPreviewActionStyle(pub NSInteger);
1526impl UIPreviewActionStyle {
1527 #[deprecated = "Please use UIContextMenuInteraction."]
1528 #[doc(alias = "UIPreviewActionStyleDefault")]
1529 pub const Default: Self = Self(0);
1530 #[deprecated = "Please use UIContextMenuInteraction."]
1531 #[doc(alias = "UIPreviewActionStyleSelected")]
1532 pub const Selected: Self = Self(1);
1533 #[deprecated = "Please use UIContextMenuInteraction."]
1534 #[doc(alias = "UIPreviewActionStyleDestructive")]
1535 pub const Destructive: Self = Self(2);
1536}
1537
1538unsafe impl Encode for UIPreviewActionStyle {
1539 const ENCODING: Encoding = NSInteger::ENCODING;
1540}
1541
1542unsafe impl RefEncode for UIPreviewActionStyle {
1543 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1544}
1545
1546extern_class!(
1547 #[unsafe(super(NSObject))]
1549 #[thread_kind = MainThreadOnly]
1550 #[derive(Debug, PartialEq, Eq, Hash)]
1551 #[deprecated = "Please use UIContextMenuInteraction."]
1552 pub struct UIPreviewAction;
1553);
1554
1555unsafe impl NSCopying for UIPreviewAction {}
1556
1557unsafe impl CopyingHelper for UIPreviewAction {
1558 type Result = Self;
1559}
1560
1561unsafe impl NSObjectProtocol for UIPreviewAction {}
1562
1563unsafe impl UIPreviewActionItem for UIPreviewAction {}
1564
1565impl UIPreviewAction {
1566 extern_methods!(
1567 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1568 #[unsafe(method(handler))]
1569 #[unsafe(method_family = none)]
1570 pub unsafe fn handler(
1571 &self,
1572 ) -> NonNull<
1573 block2::Block<
1574 dyn Fn(NonNull<ProtocolObject<dyn UIPreviewActionItem>>, NonNull<UIViewController>),
1575 >,
1576 >;
1577
1578 #[cfg(all(feature = "UIResponder", feature = "block2"))]
1579 #[unsafe(method(actionWithTitle:style:handler:))]
1580 #[unsafe(method_family = none)]
1581 pub unsafe fn actionWithTitle_style_handler(
1582 title: &NSString,
1583 style: UIPreviewActionStyle,
1584 handler: &block2::Block<dyn Fn(NonNull<UIPreviewAction>, NonNull<UIViewController>)>,
1585 mtm: MainThreadMarker,
1586 ) -> Retained<Self>;
1587 );
1588}
1589
1590impl UIPreviewAction {
1592 extern_methods!(
1593 #[unsafe(method(init))]
1594 #[unsafe(method_family = init)]
1595 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1596
1597 #[unsafe(method(new))]
1598 #[unsafe(method_family = new)]
1599 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1600 );
1601}
1602
1603extern_class!(
1604 #[unsafe(super(NSObject))]
1606 #[thread_kind = MainThreadOnly]
1607 #[derive(Debug, PartialEq, Eq, Hash)]
1608 #[deprecated = "Please use UIContextMenuInteraction."]
1609 pub struct UIPreviewActionGroup;
1610);
1611
1612unsafe impl NSCopying for UIPreviewActionGroup {}
1613
1614unsafe impl CopyingHelper for UIPreviewActionGroup {
1615 type Result = Self;
1616}
1617
1618unsafe impl NSObjectProtocol for UIPreviewActionGroup {}
1619
1620unsafe impl UIPreviewActionItem for UIPreviewActionGroup {}
1621
1622impl UIPreviewActionGroup {
1623 extern_methods!(
1624 #[unsafe(method(actionGroupWithTitle:style:actions:))]
1625 #[unsafe(method_family = none)]
1626 pub unsafe fn actionGroupWithTitle_style_actions(
1627 title: &NSString,
1628 style: UIPreviewActionStyle,
1629 actions: &NSArray<UIPreviewAction>,
1630 mtm: MainThreadMarker,
1631 ) -> Retained<Self>;
1632 );
1633}
1634
1635impl UIPreviewActionGroup {
1637 extern_methods!(
1638 #[unsafe(method(init))]
1639 #[unsafe(method_family = init)]
1640 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1641
1642 #[unsafe(method(new))]
1643 #[unsafe(method_family = new)]
1644 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1645 );
1646}