objc2_ui_kit/generated/
UIViewController.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uimodaltransitionstyle?language=objc)
13// NS_ENUM
14#[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/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uimodalpresentationstyle?language=objc)
37// NS_ENUM
38#[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicontentcontainer?language=objc)
76    pub unsafe trait UIContentContainer: NSObjectProtocol + MainThreadOnly {
77        #[cfg(feature = "objc2-core-foundation")]
78        #[unsafe(method(preferredContentSize))]
79        #[unsafe(method_family = none)]
80        fn preferredContentSize(&self) -> CGSize;
81
82        #[unsafe(method(preferredContentSizeDidChangeForChildContentContainer:))]
83        #[unsafe(method_family = none)]
84        fn preferredContentSizeDidChangeForChildContentContainer(
85            &self,
86            container: &ProtocolObject<dyn UIContentContainer>,
87        );
88
89        #[unsafe(method(systemLayoutFittingSizeDidChangeForChildContentContainer:))]
90        #[unsafe(method_family = none)]
91        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        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        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        fn willTransitionToTraitCollection_withTransitionCoordinator(
124            &self,
125            new_collection: &UITraitCollection,
126            coordinator: &ProtocolObject<dyn UIViewControllerTransitionCoordinator>,
127        );
128    }
129);
130
131extern "C" {
132    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontrollershowdetailtargetdidchangenotification?language=objc)
133    pub static UIViewControllerShowDetailTargetDidChangeNotification: &'static NSNotificationName;
134}
135
136extern_class!(
137    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontroller?language=objc)
138    #[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")]
146extern_conformance!(
147    unsafe impl NSCoding for UIViewController {}
148);
149
150#[cfg(feature = "UIResponder")]
151extern_conformance!(
152    unsafe impl NSObjectProtocol for UIViewController {}
153);
154
155#[cfg(all(feature = "UIAppearance", feature = "UIResponder"))]
156extern_conformance!(
157    unsafe impl UIAppearanceContainer for UIViewController {}
158);
159
160#[cfg(feature = "UIResponder")]
161extern_conformance!(
162    unsafe impl UIContentContainer for UIViewController {}
163);
164
165#[cfg(all(feature = "UIFocus", feature = "UIResponder"))]
166extern_conformance!(
167    unsafe impl UIFocusEnvironment for UIViewController {}
168);
169
170#[cfg(feature = "UIResponder")]
171extern_conformance!(
172    unsafe impl UIResponderStandardEditActions for UIViewController {}
173);
174
175#[cfg(all(feature = "UIResponder", feature = "UITraitCollection"))]
176extern_conformance!(
177    unsafe impl UITraitEnvironment for UIViewController {}
178);
179
180#[cfg(feature = "UIResponder")]
181impl UIViewController {
182    extern_methods!(
183        #[unsafe(method(initWithNibName:bundle:))]
184        #[unsafe(method_family = init)]
185        pub fn initWithNibName_bundle(
186            this: Allocated<Self>,
187            nib_name_or_nil: Option<&NSString>,
188            nib_bundle_or_nil: Option<&NSBundle>,
189        ) -> Retained<Self>;
190
191        /// # Safety
192        ///
193        /// `coder` possibly has further requirements.
194        #[unsafe(method(initWithCoder:))]
195        #[unsafe(method_family = init)]
196        pub unsafe fn initWithCoder(
197            this: Allocated<Self>,
198            coder: &NSCoder,
199        ) -> Option<Retained<Self>>;
200
201        #[cfg(feature = "UIView")]
202        #[unsafe(method(view))]
203        #[unsafe(method_family = none)]
204        pub fn view(&self) -> Option<Retained<UIView>>;
205
206        #[cfg(feature = "UIView")]
207        /// Setter for [`view`][Self::view].
208        #[unsafe(method(setView:))]
209        #[unsafe(method_family = none)]
210        pub fn setView(&self, view: Option<&UIView>);
211
212        #[unsafe(method(loadView))]
213        #[unsafe(method_family = none)]
214        pub fn loadView(&self);
215
216        #[unsafe(method(loadViewIfNeeded))]
217        #[unsafe(method_family = none)]
218        pub fn loadViewIfNeeded(&self);
219
220        #[cfg(feature = "UIView")]
221        #[unsafe(method(viewIfLoaded))]
222        #[unsafe(method_family = none)]
223        pub fn viewIfLoaded(&self) -> Option<Retained<UIView>>;
224
225        #[deprecated]
226        #[unsafe(method(viewWillUnload))]
227        #[unsafe(method_family = none)]
228        pub fn viewWillUnload(&self);
229
230        #[deprecated]
231        #[unsafe(method(viewDidUnload))]
232        #[unsafe(method_family = none)]
233        pub fn viewDidUnload(&self);
234
235        #[unsafe(method(viewDidLoad))]
236        #[unsafe(method_family = none)]
237        pub fn viewDidLoad(&self);
238
239        #[unsafe(method(isViewLoaded))]
240        #[unsafe(method_family = none)]
241        pub fn isViewLoaded(&self) -> bool;
242
243        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
244        #[unsafe(method(nibName))]
245        #[unsafe(method_family = none)]
246        pub fn nibName(&self) -> Option<Retained<NSString>>;
247
248        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
249        #[unsafe(method(nibBundle))]
250        #[unsafe(method_family = none)]
251        pub fn nibBundle(&self) -> Option<Retained<NSBundle>>;
252
253        #[cfg(feature = "UIStoryboard")]
254        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
255        #[unsafe(method(storyboard))]
256        #[unsafe(method_family = none)]
257        pub fn storyboard(&self) -> Option<Retained<UIStoryboard>>;
258
259        /// # Safety
260        ///
261        /// `sender` should be of the correct type.
262        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
263        #[unsafe(method(performSegueWithIdentifier:sender:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn performSegueWithIdentifier_sender(
266            &self,
267            identifier: &NSString,
268            sender: Option<&AnyObject>,
269        );
270
271        /// # Safety
272        ///
273        /// `sender` should be of the correct type.
274        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
275        #[unsafe(method(shouldPerformSegueWithIdentifier:sender:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn shouldPerformSegueWithIdentifier_sender(
278            &self,
279            identifier: &NSString,
280            sender: Option<&AnyObject>,
281        ) -> bool;
282
283        #[cfg(feature = "UIStoryboardSegue")]
284        /// # Safety
285        ///
286        /// `sender` should be of the correct type.
287        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
288        #[unsafe(method(prepareForSegue:sender:))]
289        #[unsafe(method_family = none)]
290        pub unsafe fn prepareForSegue_sender(
291            &self,
292            segue: &UIStoryboardSegue,
293            sender: Option<&AnyObject>,
294        );
295
296        /// # Safety
297        ///
298        /// - `action` must be a valid selector.
299        /// - `sender` should be of the correct type.
300        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
301        #[unsafe(method(canPerformUnwindSegueAction:fromViewController:sender:))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn canPerformUnwindSegueAction_fromViewController_sender(
304            &self,
305            action: Sel,
306            from_view_controller: &UIViewController,
307            sender: Option<&AnyObject>,
308        ) -> bool;
309
310        /// # Safety
311        ///
312        /// - `action` must be a valid selector.
313        /// - `sender` should be of the correct type.
314        #[deprecated]
315        #[unsafe(method(canPerformUnwindSegueAction:fromViewController:withSender:))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn canPerformUnwindSegueAction_fromViewController_withSender(
318            &self,
319            action: Sel,
320            from_view_controller: &UIViewController,
321            sender: &AnyObject,
322        ) -> bool;
323
324        #[cfg(feature = "UIStoryboardSegue")]
325        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
326        #[unsafe(method(allowedChildViewControllersForUnwindingFromSource:))]
327        #[unsafe(method_family = none)]
328        pub fn allowedChildViewControllersForUnwindingFromSource(
329            &self,
330            source: &UIStoryboardUnwindSegueSource,
331        ) -> Retained<NSArray<UIViewController>>;
332
333        #[cfg(feature = "UIStoryboardSegue")]
334        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
335        #[unsafe(method(childViewControllerContainingSegueSource:))]
336        #[unsafe(method_family = none)]
337        pub fn childViewControllerContainingSegueSource(
338            &self,
339            source: &UIStoryboardUnwindSegueSource,
340        ) -> Option<Retained<UIViewController>>;
341
342        /// # Safety
343        ///
344        /// - `action` must be a valid selector.
345        /// - `sender` should be of the correct type.
346        #[deprecated]
347        #[unsafe(method(viewControllerForUnwindSegueAction:fromViewController:withSender:))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn viewControllerForUnwindSegueAction_fromViewController_withSender(
350            &self,
351            action: Sel,
352            from_view_controller: &UIViewController,
353            sender: Option<&AnyObject>,
354        ) -> Option<Retained<UIViewController>>;
355
356        #[cfg(feature = "UIStoryboardSegue")]
357        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
358        #[unsafe(method(unwindForSegue:towardsViewController:))]
359        #[unsafe(method_family = none)]
360        pub fn unwindForSegue_towardsViewController(
361            &self,
362            unwind_segue: &UIStoryboardSegue,
363            subsequent_vc: &UIViewController,
364        );
365
366        #[cfg(feature = "UIStoryboardSegue")]
367        #[deprecated]
368        #[unsafe(method(segueForUnwindingToViewController:fromViewController:identifier:))]
369        #[unsafe(method_family = none)]
370        pub fn segueForUnwindingToViewController_fromViewController_identifier(
371            &self,
372            to_view_controller: &UIViewController,
373            from_view_controller: &UIViewController,
374            identifier: Option<&NSString>,
375        ) -> Option<Retained<UIStoryboardSegue>>;
376
377        /// Called when the view is about to made visible, before it is added to the hierarchy.
378        /// Because the view is not yet in the hierarchy at the time this method is called, it
379        /// is too early in the appearance transition for many usages. Prefer -viewIsAppearing:
380        /// instead of this method when possible. Only use this method when its exact timing
381        /// before the appearance transition starts running is desired, such as to set up an
382        /// alongside animation with a transition coordinator, or as a counterpart for paired
383        /// code in a viewWillDisappear/viewDidDisappear callback that does not rely on the
384        /// view or view controller's trait collection or the view hierarchy.
385        #[unsafe(method(viewWillAppear:))]
386        #[unsafe(method_family = none)]
387        pub fn viewWillAppear(&self, animated: bool);
388
389        /// Called when the view is becoming visible at the beginning of the appearance transition,
390        /// after it has been added to the hierarchy and been laid out by its superview. This method
391        /// is very similar to -viewWillAppear: and is always called shortly afterwards (so changes
392        /// made in either callback will be visible to the user at the same time), but unlike
393        /// -viewWillAppear:, at the time when -viewIsAppearing: is called all of the following are
394        /// valid for the view controller and its own view:
395        /// - View controller and view's trait collection
396        /// - View's superview chain and window
397        /// - View's geometry (e.g. frame/bounds, safe area insets, layout margins)
398        /// Choose this method instead of -viewWillAppear: by default, as it is a direct replacement
399        /// that provides equivalent or superior behavior in nearly all cases.
400        #[unsafe(method(viewIsAppearing:))]
401        #[unsafe(method_family = none)]
402        pub fn viewIsAppearing(&self, animated: bool);
403
404        /// Called after the view has fully transitioned to visible, when any transition animations have completed.
405        #[unsafe(method(viewDidAppear:))]
406        #[unsafe(method_family = none)]
407        pub fn viewDidAppear(&self, animated: bool);
408
409        /// Called when the view is about to be dismissed, covered, or otherwise hidden.
410        #[unsafe(method(viewWillDisappear:))]
411        #[unsafe(method_family = none)]
412        pub fn viewWillDisappear(&self, animated: bool);
413
414        /// Called after the view has fully been dismissed, covered, or otherwise hidden, when any transition animations have completed.
415        #[unsafe(method(viewDidDisappear:))]
416        #[unsafe(method_family = none)]
417        pub fn viewDidDisappear(&self, animated: bool);
418
419        /// Call to manually request a properties update for the view controller.
420        /// Multiple requests may be coalesced into a single update alongside the next layout pass.
421        #[unsafe(method(setNeedsUpdateProperties))]
422        #[unsafe(method_family = none)]
423        pub fn setNeedsUpdateProperties(&self);
424
425        /// Override point for subclasses to update properties of this view controller or its view.
426        /// Never call this method directly; use `setNeedsUpdateProperties` to schedule an update.
427        #[unsafe(method(updateProperties))]
428        #[unsafe(method_family = none)]
429        pub fn updateProperties(&self);
430
431        /// Forces an immediate properties update for this view controller and its view,
432        /// including any view controllers and views in this subtree.
433        #[unsafe(method(updatePropertiesIfNeeded))]
434        #[unsafe(method_family = none)]
435        pub fn updatePropertiesIfNeeded(&self);
436
437        #[unsafe(method(viewWillLayoutSubviews))]
438        #[unsafe(method_family = none)]
439        pub fn viewWillLayoutSubviews(&self);
440
441        #[unsafe(method(viewDidLayoutSubviews))]
442        #[unsafe(method_family = none)]
443        pub fn viewDidLayoutSubviews(&self);
444
445        #[unsafe(method(title))]
446        #[unsafe(method_family = none)]
447        pub fn title(&self) -> Option<Retained<NSString>>;
448
449        /// Setter for [`title`][Self::title].
450        ///
451        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
452        #[unsafe(method(setTitle:))]
453        #[unsafe(method_family = none)]
454        pub fn setTitle(&self, title: Option<&NSString>);
455
456        #[unsafe(method(didReceiveMemoryWarning))]
457        #[unsafe(method_family = none)]
458        pub fn didReceiveMemoryWarning(&self);
459
460        #[unsafe(method(parentViewController))]
461        #[unsafe(method_family = none)]
462        pub fn parentViewController(&self) -> Option<Retained<UIViewController>>;
463
464        #[deprecated]
465        #[unsafe(method(modalViewController))]
466        #[unsafe(method_family = none)]
467        pub fn modalViewController(&self) -> Option<Retained<UIViewController>>;
468
469        #[unsafe(method(presentedViewController))]
470        #[unsafe(method_family = none)]
471        pub fn presentedViewController(&self) -> Option<Retained<UIViewController>>;
472
473        #[unsafe(method(presentingViewController))]
474        #[unsafe(method_family = none)]
475        pub fn presentingViewController(&self) -> Option<Retained<UIViewController>>;
476
477        #[unsafe(method(definesPresentationContext))]
478        #[unsafe(method_family = none)]
479        pub fn definesPresentationContext(&self) -> bool;
480
481        /// Setter for [`definesPresentationContext`][Self::definesPresentationContext].
482        #[unsafe(method(setDefinesPresentationContext:))]
483        #[unsafe(method_family = none)]
484        pub fn setDefinesPresentationContext(&self, defines_presentation_context: bool);
485
486        #[unsafe(method(providesPresentationContextTransitionStyle))]
487        #[unsafe(method_family = none)]
488        pub fn providesPresentationContextTransitionStyle(&self) -> bool;
489
490        /// Setter for [`providesPresentationContextTransitionStyle`][Self::providesPresentationContextTransitionStyle].
491        #[unsafe(method(setProvidesPresentationContextTransitionStyle:))]
492        #[unsafe(method_family = none)]
493        pub fn setProvidesPresentationContextTransitionStyle(
494            &self,
495            provides_presentation_context_transition_style: bool,
496        );
497
498        #[unsafe(method(restoresFocusAfterTransition))]
499        #[unsafe(method_family = none)]
500        pub fn restoresFocusAfterTransition(&self) -> bool;
501
502        /// Setter for [`restoresFocusAfterTransition`][Self::restoresFocusAfterTransition].
503        #[unsafe(method(setRestoresFocusAfterTransition:))]
504        #[unsafe(method_family = none)]
505        pub fn setRestoresFocusAfterTransition(&self, restores_focus_after_transition: bool);
506
507        /// The identifier of the focus group that this view controller belongs to. If this is nil, the view controller inherits the focus group of its parent focus environment.
508        #[unsafe(method(focusGroupIdentifier))]
509        #[unsafe(method_family = none)]
510        pub fn focusGroupIdentifier(&self) -> Option<Retained<NSString>>;
511
512        /// Setter for [`focusGroupIdentifier`][Self::focusGroupIdentifier].
513        ///
514        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
515        #[unsafe(method(setFocusGroupIdentifier:))]
516        #[unsafe(method_family = none)]
517        pub fn setFocusGroupIdentifier(&self, focus_group_identifier: Option<&NSString>);
518
519        /// The base name for tracking user interactions as activities hosted by this view controller.
520        #[unsafe(method(interactionActivityTrackingBaseName))]
521        #[unsafe(method_family = none)]
522        pub fn interactionActivityTrackingBaseName(&self) -> Option<Retained<NSString>>;
523
524        /// Setter for [`interactionActivityTrackingBaseName`][Self::interactionActivityTrackingBaseName].
525        ///
526        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
527        #[unsafe(method(setInteractionActivityTrackingBaseName:))]
528        #[unsafe(method_family = none)]
529        pub fn setInteractionActivityTrackingBaseName(
530            &self,
531            interaction_activity_tracking_base_name: Option<&NSString>,
532        );
533
534        #[unsafe(method(isBeingPresented))]
535        #[unsafe(method_family = none)]
536        pub fn isBeingPresented(&self) -> bool;
537
538        #[unsafe(method(isBeingDismissed))]
539        #[unsafe(method_family = none)]
540        pub fn isBeingDismissed(&self) -> bool;
541
542        #[unsafe(method(isMovingToParentViewController))]
543        #[unsafe(method_family = none)]
544        pub fn isMovingToParentViewController(&self) -> bool;
545
546        #[unsafe(method(isMovingFromParentViewController))]
547        #[unsafe(method_family = none)]
548        pub fn isMovingFromParentViewController(&self) -> bool;
549
550        #[cfg(feature = "block2")]
551        #[unsafe(method(presentViewController:animated:completion:))]
552        #[unsafe(method_family = none)]
553        pub fn presentViewController_animated_completion(
554            &self,
555            view_controller_to_present: &UIViewController,
556            flag: bool,
557            completion: Option<&block2::DynBlock<dyn Fn()>>,
558        );
559
560        #[cfg(feature = "block2")]
561        #[unsafe(method(dismissViewControllerAnimated:completion:))]
562        #[unsafe(method_family = none)]
563        pub fn dismissViewControllerAnimated_completion(
564            &self,
565            flag: bool,
566            completion: Option<&block2::DynBlock<dyn Fn()>>,
567        );
568
569        #[deprecated]
570        #[unsafe(method(presentModalViewController:animated:))]
571        #[unsafe(method_family = none)]
572        pub fn presentModalViewController_animated(
573            &self,
574            modal_view_controller: &UIViewController,
575            animated: bool,
576        );
577
578        #[deprecated]
579        #[unsafe(method(dismissModalViewControllerAnimated:))]
580        #[unsafe(method_family = none)]
581        pub fn dismissModalViewControllerAnimated(&self, animated: bool);
582
583        #[unsafe(method(modalTransitionStyle))]
584        #[unsafe(method_family = none)]
585        pub fn modalTransitionStyle(&self) -> UIModalTransitionStyle;
586
587        /// Setter for [`modalTransitionStyle`][Self::modalTransitionStyle].
588        #[unsafe(method(setModalTransitionStyle:))]
589        #[unsafe(method_family = none)]
590        pub fn setModalTransitionStyle(&self, modal_transition_style: UIModalTransitionStyle);
591
592        #[cfg(feature = "UIViewControllerTransition")]
593        /// Preferred system provided transition to use when displaying this
594        /// view controller. Note that this only indicates a preference.
595        /// The provided transition may be ignored if not supported by the
596        /// current context. For example, `UINavigationController` supports
597        /// the .zoom transition, but not the .coverVertical transition.
598        #[unsafe(method(preferredTransition))]
599        #[unsafe(method_family = none)]
600        pub fn preferredTransition(&self) -> Option<Retained<UIViewControllerTransition>>;
601
602        #[cfg(feature = "UIViewControllerTransition")]
603        /// Setter for [`preferredTransition`][Self::preferredTransition].
604        #[unsafe(method(setPreferredTransition:))]
605        #[unsafe(method_family = none)]
606        pub fn setPreferredTransition(
607            &self,
608            preferred_transition: Option<&UIViewControllerTransition>,
609        );
610
611        #[unsafe(method(modalPresentationStyle))]
612        #[unsafe(method_family = none)]
613        pub fn modalPresentationStyle(&self) -> UIModalPresentationStyle;
614
615        /// Setter for [`modalPresentationStyle`][Self::modalPresentationStyle].
616        #[unsafe(method(setModalPresentationStyle:))]
617        #[unsafe(method_family = none)]
618        pub fn setModalPresentationStyle(&self, modal_presentation_style: UIModalPresentationStyle);
619
620        #[unsafe(method(modalPresentationCapturesStatusBarAppearance))]
621        #[unsafe(method_family = none)]
622        pub fn modalPresentationCapturesStatusBarAppearance(&self) -> bool;
623
624        /// Setter for [`modalPresentationCapturesStatusBarAppearance`][Self::modalPresentationCapturesStatusBarAppearance].
625        #[unsafe(method(setModalPresentationCapturesStatusBarAppearance:))]
626        #[unsafe(method_family = none)]
627        pub fn setModalPresentationCapturesStatusBarAppearance(
628            &self,
629            modal_presentation_captures_status_bar_appearance: bool,
630        );
631
632        #[unsafe(method(disablesAutomaticKeyboardDismissal))]
633        #[unsafe(method_family = none)]
634        pub fn disablesAutomaticKeyboardDismissal(&self) -> bool;
635
636        #[deprecated]
637        #[unsafe(method(wantsFullScreenLayout))]
638        #[unsafe(method_family = none)]
639        pub fn wantsFullScreenLayout(&self) -> bool;
640
641        /// Setter for [`wantsFullScreenLayout`][Self::wantsFullScreenLayout].
642        #[deprecated]
643        #[unsafe(method(setWantsFullScreenLayout:))]
644        #[unsafe(method_family = none)]
645        pub fn setWantsFullScreenLayout(&self, wants_full_screen_layout: bool);
646
647        #[cfg(feature = "UIGeometry")]
648        #[unsafe(method(edgesForExtendedLayout))]
649        #[unsafe(method_family = none)]
650        pub fn edgesForExtendedLayout(&self) -> UIRectEdge;
651
652        #[cfg(feature = "UIGeometry")]
653        /// Setter for [`edgesForExtendedLayout`][Self::edgesForExtendedLayout].
654        #[unsafe(method(setEdgesForExtendedLayout:))]
655        #[unsafe(method_family = none)]
656        pub fn setEdgesForExtendedLayout(&self, edges_for_extended_layout: UIRectEdge);
657
658        #[unsafe(method(extendedLayoutIncludesOpaqueBars))]
659        #[unsafe(method_family = none)]
660        pub fn extendedLayoutIncludesOpaqueBars(&self) -> bool;
661
662        /// Setter for [`extendedLayoutIncludesOpaqueBars`][Self::extendedLayoutIncludesOpaqueBars].
663        #[unsafe(method(setExtendedLayoutIncludesOpaqueBars:))]
664        #[unsafe(method_family = none)]
665        pub fn setExtendedLayoutIncludesOpaqueBars(
666            &self,
667            extended_layout_includes_opaque_bars: bool,
668        );
669
670        #[deprecated = "Use UIScrollView's contentInsetAdjustmentBehavior instead"]
671        #[unsafe(method(automaticallyAdjustsScrollViewInsets))]
672        #[unsafe(method_family = none)]
673        pub fn automaticallyAdjustsScrollViewInsets(&self) -> bool;
674
675        /// Setter for [`automaticallyAdjustsScrollViewInsets`][Self::automaticallyAdjustsScrollViewInsets].
676        #[deprecated = "Use UIScrollView's contentInsetAdjustmentBehavior instead"]
677        #[unsafe(method(setAutomaticallyAdjustsScrollViewInsets:))]
678        #[unsafe(method_family = none)]
679        pub fn setAutomaticallyAdjustsScrollViewInsets(
680            &self,
681            automatically_adjusts_scroll_view_insets: bool,
682        );
683
684        #[cfg(all(feature = "UIGeometry", feature = "UIScrollView", feature = "UIView"))]
685        /// Aggregate values (e.g., NSDirectionalRectEdgeAll) are accepted in the `edge` parameter; NSDirectionalRectEdgeLeading and Trailing are ignored on iOS 15.0
686        #[unsafe(method(setContentScrollView:forEdge:))]
687        #[unsafe(method_family = none)]
688        pub fn setContentScrollView_forEdge(
689            &self,
690            scroll_view: Option<&UIScrollView>,
691            edge: NSDirectionalRectEdge,
692        );
693
694        #[cfg(all(feature = "UIGeometry", feature = "UIScrollView", feature = "UIView"))]
695        /// Pass only a single edge (e.g., NSDirectionalRectEdgeTop) in the `edge` parameter. Raises an exception when passed an aggregate edge (e.g., NSDirectionalRectEdgeAll)
696        #[unsafe(method(contentScrollViewForEdge:))]
697        #[unsafe(method_family = none)]
698        pub fn contentScrollViewForEdge(
699            &self,
700            edge: NSDirectionalRectEdge,
701        ) -> Option<Retained<UIScrollView>>;
702
703        #[cfg(feature = "objc2-core-foundation")]
704        #[unsafe(method(preferredContentSize))]
705        #[unsafe(method_family = none)]
706        pub fn preferredContentSize(&self) -> CGSize;
707
708        #[cfg(feature = "objc2-core-foundation")]
709        /// Setter for [`preferredContentSize`][Self::preferredContentSize].
710        #[unsafe(method(setPreferredContentSize:))]
711        #[unsafe(method_family = none)]
712        pub fn setPreferredContentSize(&self, preferred_content_size: CGSize);
713
714        #[cfg(feature = "UIApplication")]
715        #[deprecated = "Has no effect on visionOS"]
716        #[unsafe(method(preferredStatusBarStyle))]
717        #[unsafe(method_family = none)]
718        pub fn preferredStatusBarStyle(&self) -> UIStatusBarStyle;
719
720        #[deprecated = "Has no effect on visionOS"]
721        #[unsafe(method(prefersStatusBarHidden))]
722        #[unsafe(method_family = none)]
723        pub fn prefersStatusBarHidden(&self) -> bool;
724
725        #[cfg(feature = "UIApplication")]
726        #[deprecated = "Has no effect on visionOS"]
727        #[unsafe(method(preferredStatusBarUpdateAnimation))]
728        #[unsafe(method_family = none)]
729        pub fn preferredStatusBarUpdateAnimation(&self) -> UIStatusBarAnimation;
730
731        #[unsafe(method(setNeedsStatusBarAppearanceUpdate))]
732        #[unsafe(method_family = none)]
733        pub fn setNeedsStatusBarAppearanceUpdate(&self);
734
735        /// # Safety
736        ///
737        /// - `action` must be a valid selector.
738        /// - `sender` should be of the correct type.
739        #[unsafe(method(targetViewControllerForAction:sender:))]
740        #[unsafe(method_family = none)]
741        pub unsafe fn targetViewControllerForAction_sender(
742            &self,
743            action: Sel,
744            sender: Option<&AnyObject>,
745        ) -> Option<Retained<UIViewController>>;
746
747        /// # Safety
748        ///
749        /// `sender` should be of the correct type.
750        #[unsafe(method(showViewController:sender:))]
751        #[unsafe(method_family = none)]
752        pub unsafe fn showViewController_sender(
753            &self,
754            vc: &UIViewController,
755            sender: Option<&AnyObject>,
756        );
757
758        /// # Safety
759        ///
760        /// `sender` should be of the correct type.
761        #[unsafe(method(showDetailViewController:sender:))]
762        #[unsafe(method_family = none)]
763        pub unsafe fn showDetailViewController_sender(
764            &self,
765            vc: &UIViewController,
766            sender: Option<&AnyObject>,
767        );
768
769        #[cfg(feature = "UIInterface")]
770        #[unsafe(method(preferredUserInterfaceStyle))]
771        #[unsafe(method_family = none)]
772        pub fn preferredUserInterfaceStyle(&self) -> UIUserInterfaceStyle;
773
774        #[unsafe(method(setNeedsUserInterfaceAppearanceUpdate))]
775        #[unsafe(method_family = none)]
776        pub fn setNeedsUserInterfaceAppearanceUpdate(&self);
777
778        #[cfg(feature = "UIInterface")]
779        #[unsafe(method(overrideUserInterfaceStyle))]
780        #[unsafe(method_family = none)]
781        pub fn overrideUserInterfaceStyle(&self) -> UIUserInterfaceStyle;
782
783        #[cfg(feature = "UIInterface")]
784        /// Setter for [`overrideUserInterfaceStyle`][Self::overrideUserInterfaceStyle].
785        #[unsafe(method(setOverrideUserInterfaceStyle:))]
786        #[unsafe(method_family = none)]
787        pub fn setOverrideUserInterfaceStyle(
788            &self,
789            override_user_interface_style: UIUserInterfaceStyle,
790        );
791    );
792}
793
794/// Methods declared on superclass `NSObject`.
795#[cfg(feature = "UIResponder")]
796impl UIViewController {
797    extern_methods!(
798        #[unsafe(method(init))]
799        #[unsafe(method_family = init)]
800        pub fn init(this: Allocated<Self>) -> Retained<Self>;
801
802        #[unsafe(method(new))]
803        #[unsafe(method_family = new)]
804        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
805    );
806}
807
808/// UIViewControllerRotation.
809#[cfg(feature = "UIResponder")]
810impl UIViewController {
811    extern_methods!(
812        #[deprecated = "Please use instance method `setNeedsUpdateOfSupportedInterfaceOrientations`."]
813        #[unsafe(method(attemptRotationToDeviceOrientation))]
814        #[unsafe(method_family = none)]
815        pub fn attemptRotationToDeviceOrientation(mtm: MainThreadMarker);
816
817        #[cfg(feature = "UIOrientation")]
818        #[deprecated]
819        #[unsafe(method(shouldAutorotateToInterfaceOrientation:))]
820        #[unsafe(method_family = none)]
821        pub fn shouldAutorotateToInterfaceOrientation(
822            &self,
823            to_interface_orientation: UIInterfaceOrientation,
824        ) -> bool;
825
826        #[deprecated = "Update supported interface orientations and call setNeedsUpdateOfSupportedInterfaceOrientations to indicate a change."]
827        #[unsafe(method(shouldAutorotate))]
828        #[unsafe(method_family = none)]
829        pub fn shouldAutorotate(&self) -> bool;
830
831        #[cfg(feature = "UIOrientation")]
832        #[unsafe(method(supportedInterfaceOrientations))]
833        #[unsafe(method_family = none)]
834        pub fn supportedInterfaceOrientations(&self) -> UIInterfaceOrientationMask;
835
836        #[cfg(feature = "UIOrientation")]
837        #[unsafe(method(preferredInterfaceOrientationForPresentation))]
838        #[unsafe(method_family = none)]
839        pub fn preferredInterfaceOrientationForPresentation(&self) -> UIInterfaceOrientation;
840
841        /// Notifies the view controller that a change occurred that affects supported interface orientations or the preferred interface orientation for presentation.
842        /// By default, this will animate any changes to orientation. To perform a non-animated update, call within `[UIView performWithoutAnimation:]`.
843        #[unsafe(method(setNeedsUpdateOfSupportedInterfaceOrientations))]
844        #[unsafe(method_family = none)]
845        pub fn setNeedsUpdateOfSupportedInterfaceOrientations(&self);
846
847        #[cfg(feature = "UIView")]
848        #[deprecated = "Header views are animated along with the rest of the view hierarchy"]
849        #[unsafe(method(rotatingHeaderView))]
850        #[unsafe(method_family = none)]
851        pub fn rotatingHeaderView(&self) -> Option<Retained<UIView>>;
852
853        #[cfg(feature = "UIView")]
854        #[deprecated = "Footer views are animated along with the rest of the view hierarchy"]
855        #[unsafe(method(rotatingFooterView))]
856        #[unsafe(method_family = none)]
857        pub fn rotatingFooterView(&self) -> Option<Retained<UIView>>;
858
859        #[cfg(feature = "UIOrientation")]
860        #[deprecated]
861        #[unsafe(method(interfaceOrientation))]
862        #[unsafe(method_family = none)]
863        pub fn interfaceOrientation(&self) -> UIInterfaceOrientation;
864
865        #[cfg(feature = "UIOrientation")]
866        #[deprecated = "Implement viewWillTransitionToSize:withTransitionCoordinator: instead"]
867        #[unsafe(method(willRotateToInterfaceOrientation:duration:))]
868        #[unsafe(method_family = none)]
869        pub fn willRotateToInterfaceOrientation_duration(
870            &self,
871            to_interface_orientation: UIInterfaceOrientation,
872            duration: NSTimeInterval,
873        );
874
875        #[cfg(feature = "UIOrientation")]
876        #[deprecated]
877        #[unsafe(method(didRotateFromInterfaceOrientation:))]
878        #[unsafe(method_family = none)]
879        pub fn didRotateFromInterfaceOrientation(
880            &self,
881            from_interface_orientation: UIInterfaceOrientation,
882        );
883
884        #[cfg(feature = "UIOrientation")]
885        #[deprecated = "Implement viewWillTransitionToSize:withTransitionCoordinator: instead"]
886        #[unsafe(method(willAnimateRotationToInterfaceOrientation:duration:))]
887        #[unsafe(method_family = none)]
888        pub fn willAnimateRotationToInterfaceOrientation_duration(
889            &self,
890            to_interface_orientation: UIInterfaceOrientation,
891            duration: NSTimeInterval,
892        );
893
894        #[cfg(feature = "UIOrientation")]
895        #[deprecated]
896        #[unsafe(method(willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:))]
897        #[unsafe(method_family = none)]
898        pub fn willAnimateFirstHalfOfRotationToInterfaceOrientation_duration(
899            &self,
900            to_interface_orientation: UIInterfaceOrientation,
901            duration: NSTimeInterval,
902        );
903
904        #[cfg(feature = "UIOrientation")]
905        #[deprecated]
906        #[unsafe(method(didAnimateFirstHalfOfRotationToInterfaceOrientation:))]
907        #[unsafe(method_family = none)]
908        pub fn didAnimateFirstHalfOfRotationToInterfaceOrientation(
909            &self,
910            to_interface_orientation: UIInterfaceOrientation,
911        );
912
913        #[cfg(feature = "UIOrientation")]
914        #[deprecated]
915        #[unsafe(method(willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:))]
916        #[unsafe(method_family = none)]
917        pub fn willAnimateSecondHalfOfRotationFromInterfaceOrientation_duration(
918            &self,
919            from_interface_orientation: UIInterfaceOrientation,
920            duration: NSTimeInterval,
921        );
922    );
923}
924
925/// UIViewControllerEditing.
926#[cfg(feature = "UIResponder")]
927impl UIViewController {
928    extern_methods!(
929        #[unsafe(method(isEditing))]
930        #[unsafe(method_family = none)]
931        pub fn isEditing(&self) -> bool;
932
933        /// Setter for [`isEditing`][Self::isEditing].
934        #[unsafe(method(setEditing:))]
935        #[unsafe(method_family = none)]
936        pub fn setEditing(&self, editing: bool);
937
938        #[unsafe(method(setEditing:animated:))]
939        #[unsafe(method_family = none)]
940        pub fn setEditing_animated(&self, editing: bool, animated: bool);
941
942        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
943        #[unsafe(method(editButtonItem))]
944        #[unsafe(method_family = none)]
945        pub fn editButtonItem(&self) -> Retained<UIBarButtonItem>;
946    );
947}
948
949/// UISearchDisplayControllerSupport.
950#[cfg(feature = "UIResponder")]
951impl UIViewController {
952    extern_methods!(
953        #[cfg(feature = "UISearchDisplayController")]
954        #[deprecated]
955        #[unsafe(method(searchDisplayController))]
956        #[unsafe(method_family = none)]
957        pub fn searchDisplayController(&self) -> Option<Retained<UISearchDisplayController>>;
958    );
959}
960
961extern "C" {
962    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontrollerhierarchyinconsistencyexception?language=objc)
963    pub static UIViewControllerHierarchyInconsistencyException: &'static NSExceptionName;
964}
965
966/// UIContainerViewControllerProtectedMethods.
967#[cfg(feature = "UIResponder")]
968impl UIViewController {
969    extern_methods!(
970        #[unsafe(method(childViewControllers))]
971        #[unsafe(method_family = none)]
972        pub fn childViewControllers(&self) -> Retained<NSArray<UIViewController>>;
973
974        #[unsafe(method(addChildViewController:))]
975        #[unsafe(method_family = none)]
976        pub fn addChildViewController(&self, child_controller: &UIViewController);
977
978        #[unsafe(method(removeFromParentViewController))]
979        #[unsafe(method_family = none)]
980        pub fn removeFromParentViewController(&self);
981
982        #[cfg(all(feature = "UIView", feature = "block2"))]
983        #[unsafe(method(transitionFromViewController:toViewController:duration:options:animations:completion:))]
984        #[unsafe(method_family = none)]
985        pub fn transitionFromViewController_toViewController_duration_options_animations_completion(
986            &self,
987            from_view_controller: &UIViewController,
988            to_view_controller: &UIViewController,
989            duration: NSTimeInterval,
990            options: UIViewAnimationOptions,
991            animations: Option<&block2::DynBlock<dyn Fn()>>,
992            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
993        );
994
995        #[unsafe(method(beginAppearanceTransition:animated:))]
996        #[unsafe(method_family = none)]
997        pub fn beginAppearanceTransition_animated(&self, is_appearing: bool, animated: bool);
998
999        #[unsafe(method(endAppearanceTransition))]
1000        #[unsafe(method_family = none)]
1001        pub fn endAppearanceTransition(&self);
1002
1003        #[deprecated = "Has no effect on visionOS"]
1004        #[unsafe(method(childViewControllerForStatusBarStyle))]
1005        #[unsafe(method_family = none)]
1006        pub fn childViewControllerForStatusBarStyle(&self) -> Option<Retained<UIViewController>>;
1007
1008        #[deprecated = "Has no effect on visionOS"]
1009        #[unsafe(method(childViewControllerForStatusBarHidden))]
1010        #[unsafe(method_family = none)]
1011        pub fn childViewControllerForStatusBarHidden(&self) -> Option<Retained<UIViewController>>;
1012
1013        #[cfg(feature = "UITraitCollection")]
1014        #[deprecated = "Use the traitOverrides property on the child view controller instead"]
1015        #[unsafe(method(setOverrideTraitCollection:forChildViewController:))]
1016        #[unsafe(method_family = none)]
1017        pub fn setOverrideTraitCollection_forChildViewController(
1018            &self,
1019            collection: Option<&UITraitCollection>,
1020            child_view_controller: &UIViewController,
1021        );
1022
1023        #[cfg(feature = "UITraitCollection")]
1024        #[deprecated = "Use the traitOverrides property on the child view controller instead"]
1025        #[unsafe(method(overrideTraitCollectionForChildViewController:))]
1026        #[unsafe(method_family = none)]
1027        pub fn overrideTraitCollectionForChildViewController(
1028            &self,
1029            child_view_controller: &UIViewController,
1030        ) -> Option<Retained<UITraitCollection>>;
1031
1032        #[unsafe(method(childViewControllerForUserInterfaceStyle))]
1033        #[unsafe(method_family = none)]
1034        pub fn childViewControllerForUserInterfaceStyle(
1035            &self,
1036        ) -> Option<Retained<UIViewController>>;
1037    );
1038}
1039
1040/// UIContainerViewControllerCallbacks.
1041#[cfg(feature = "UIResponder")]
1042impl UIViewController {
1043    extern_methods!(
1044        #[deprecated]
1045        #[unsafe(method(automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers))]
1046        #[unsafe(method_family = none)]
1047        pub fn automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers(
1048            &self,
1049        ) -> bool;
1050
1051        #[deprecated = "Manually forward viewWillTransitionToSize:withTransitionCoordinator: if necessary"]
1052        #[unsafe(method(shouldAutomaticallyForwardRotationMethods))]
1053        #[unsafe(method_family = none)]
1054        pub fn shouldAutomaticallyForwardRotationMethods(&self) -> bool;
1055
1056        #[unsafe(method(shouldAutomaticallyForwardAppearanceMethods))]
1057        #[unsafe(method_family = none)]
1058        pub fn shouldAutomaticallyForwardAppearanceMethods(&self) -> bool;
1059
1060        #[unsafe(method(willMoveToParentViewController:))]
1061        #[unsafe(method_family = none)]
1062        pub fn willMoveToParentViewController(&self, parent: Option<&UIViewController>);
1063
1064        #[unsafe(method(didMoveToParentViewController:))]
1065        #[unsafe(method_family = none)]
1066        pub fn didMoveToParentViewController(&self, parent: Option<&UIViewController>);
1067    );
1068}
1069
1070/// UIStateRestoration.
1071#[cfg(feature = "UIResponder")]
1072impl UIViewController {
1073    extern_methods!(
1074        #[unsafe(method(restorationIdentifier))]
1075        #[unsafe(method_family = none)]
1076        pub fn restorationIdentifier(&self) -> Option<Retained<NSString>>;
1077
1078        /// Setter for [`restorationIdentifier`][Self::restorationIdentifier].
1079        ///
1080        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1081        #[unsafe(method(setRestorationIdentifier:))]
1082        #[unsafe(method_family = none)]
1083        pub fn setRestorationIdentifier(&self, restoration_identifier: Option<&NSString>);
1084
1085        #[cfg(feature = "UIStateRestoration")]
1086        /// # Safety
1087        ///
1088        /// This is not retained internally, you must ensure the object is still alive.
1089        #[unsafe(method(restorationClass))]
1090        #[unsafe(method_family = none)]
1091        pub unsafe fn restorationClass(&self) -> Option<&'static AnyClass>;
1092
1093        #[cfg(feature = "UIStateRestoration")]
1094        /// Setter for [`restorationClass`][Self::restorationClass].
1095        ///
1096        /// # Safety
1097        ///
1098        /// - `restoration_class` must implement UIViewControllerRestoration.
1099        /// - This is unretained, you must ensure the object is kept alive while in use.
1100        #[unsafe(method(setRestorationClass:))]
1101        #[unsafe(method_family = none)]
1102        pub unsafe fn setRestorationClass(&self, restoration_class: Option<&AnyClass>);
1103
1104        /// # Safety
1105        ///
1106        /// `coder` possibly has further requirements.
1107        #[unsafe(method(encodeRestorableStateWithCoder:))]
1108        #[unsafe(method_family = none)]
1109        pub unsafe fn encodeRestorableStateWithCoder(&self, coder: &NSCoder);
1110
1111        /// # Safety
1112        ///
1113        /// `coder` possibly has further requirements.
1114        #[unsafe(method(decodeRestorableStateWithCoder:))]
1115        #[unsafe(method_family = none)]
1116        pub unsafe fn decodeRestorableStateWithCoder(&self, coder: &NSCoder);
1117
1118        #[unsafe(method(applicationFinishedRestoringState))]
1119        #[unsafe(method_family = none)]
1120        pub fn applicationFinishedRestoringState(&self);
1121    );
1122}
1123
1124#[cfg(all(feature = "UIResponder", feature = "UIStateRestoration"))]
1125extern_conformance!(
1126    unsafe impl UIStateRestoring for UIViewController {}
1127);
1128
1129/// UIConstraintBasedLayoutCoreMethods.
1130#[cfg(feature = "UIResponder")]
1131impl UIViewController {
1132    extern_methods!(
1133        #[unsafe(method(updateViewConstraints))]
1134        #[unsafe(method_family = none)]
1135        pub fn updateViewConstraints(&self);
1136    );
1137}
1138
1139/// UIViewControllerTransitioning.
1140#[cfg(feature = "UIResponder")]
1141impl UIViewController {
1142    extern_methods!(
1143        #[cfg(feature = "UIViewControllerTransitioning")]
1144        #[unsafe(method(transitioningDelegate))]
1145        #[unsafe(method_family = none)]
1146        pub fn transitioningDelegate(
1147            &self,
1148        ) -> Option<Retained<ProtocolObject<dyn UIViewControllerTransitioningDelegate>>>;
1149
1150        #[cfg(feature = "UIViewControllerTransitioning")]
1151        /// Setter for [`transitioningDelegate`][Self::transitioningDelegate].
1152        ///
1153        /// This is a [weak property][objc2::topics::weak_property].
1154        #[unsafe(method(setTransitioningDelegate:))]
1155        #[unsafe(method_family = none)]
1156        pub fn setTransitioningDelegate(
1157            &self,
1158            transitioning_delegate: Option<
1159                &ProtocolObject<dyn UIViewControllerTransitioningDelegate>,
1160            >,
1161        );
1162    );
1163}
1164
1165/// UILayoutSupport.
1166#[cfg(feature = "UIResponder")]
1167impl UIViewController {
1168    extern_methods!(
1169        #[cfg(feature = "NSLayoutConstraint")]
1170        #[deprecated = "Use view.safeAreaLayoutGuide.topAnchor instead of topLayoutGuide.bottomAnchor"]
1171        #[unsafe(method(topLayoutGuide))]
1172        #[unsafe(method_family = none)]
1173        pub fn topLayoutGuide(&self) -> Retained<ProtocolObject<dyn UILayoutSupport>>;
1174
1175        #[cfg(feature = "NSLayoutConstraint")]
1176        #[deprecated = "Use view.safeAreaLayoutGuide.bottomAnchor instead of bottomLayoutGuide.topAnchor"]
1177        #[unsafe(method(bottomLayoutGuide))]
1178        #[unsafe(method_family = none)]
1179        pub fn bottomLayoutGuide(&self) -> Retained<ProtocolObject<dyn UILayoutSupport>>;
1180
1181        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1182        #[unsafe(method(additionalSafeAreaInsets))]
1183        #[unsafe(method_family = none)]
1184        pub fn additionalSafeAreaInsets(&self) -> UIEdgeInsets;
1185
1186        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1187        /// Setter for [`additionalSafeAreaInsets`][Self::additionalSafeAreaInsets].
1188        #[unsafe(method(setAdditionalSafeAreaInsets:))]
1189        #[unsafe(method_family = none)]
1190        pub fn setAdditionalSafeAreaInsets(&self, additional_safe_area_insets: UIEdgeInsets);
1191
1192        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1193        #[unsafe(method(systemMinimumLayoutMargins))]
1194        #[unsafe(method_family = none)]
1195        pub fn systemMinimumLayoutMargins(&self) -> NSDirectionalEdgeInsets;
1196
1197        #[unsafe(method(viewRespectsSystemMinimumLayoutMargins))]
1198        #[unsafe(method_family = none)]
1199        pub fn viewRespectsSystemMinimumLayoutMargins(&self) -> bool;
1200
1201        /// Setter for [`viewRespectsSystemMinimumLayoutMargins`][Self::viewRespectsSystemMinimumLayoutMargins].
1202        #[unsafe(method(setViewRespectsSystemMinimumLayoutMargins:))]
1203        #[unsafe(method_family = none)]
1204        pub fn setViewRespectsSystemMinimumLayoutMargins(
1205            &self,
1206            view_respects_system_minimum_layout_margins: bool,
1207        );
1208
1209        #[unsafe(method(viewLayoutMarginsDidChange))]
1210        #[unsafe(method_family = none)]
1211        pub fn viewLayoutMarginsDidChange(&self);
1212
1213        #[unsafe(method(viewSafeAreaInsetsDidChange))]
1214        #[unsafe(method_family = none)]
1215        pub fn viewSafeAreaInsetsDidChange(&self);
1216    );
1217}
1218
1219/// UIKeyCommand.
1220#[cfg(feature = "UIResponder")]
1221impl UIViewController {
1222    extern_methods!(
1223        #[cfg(all(
1224            feature = "UICommand",
1225            feature = "UIKeyCommand",
1226            feature = "UIMenuElement"
1227        ))]
1228        #[unsafe(method(addKeyCommand:))]
1229        #[unsafe(method_family = none)]
1230        pub fn addKeyCommand(&self, key_command: &UIKeyCommand);
1231
1232        #[cfg(all(
1233            feature = "UICommand",
1234            feature = "UIKeyCommand",
1235            feature = "UIMenuElement"
1236        ))]
1237        #[unsafe(method(removeKeyCommand:))]
1238        #[unsafe(method_family = none)]
1239        pub fn removeKeyCommand(&self, key_command: &UIKeyCommand);
1240    );
1241}
1242
1243/// UIPerformsActions.
1244#[cfg(feature = "UIResponder")]
1245impl UIViewController {
1246    extern_methods!(
1247        /// Determines whether the receiver continues to respond to actions while it is presenting a view controller modally.
1248        ///
1249        /// Defaults to YES. You can change the default return value by providing a value for UIViewControllerPerformsActionsWhilePresentingModally in your Info.plist file.
1250        #[unsafe(method(performsActionsWhilePresentingModally))]
1251        #[unsafe(method_family = none)]
1252        pub fn performsActionsWhilePresentingModally(&self) -> bool;
1253    );
1254}
1255
1256/// NSExtensionAdditions.
1257#[cfg(feature = "UIResponder")]
1258impl UIViewController {
1259    extern_methods!(
1260        #[unsafe(method(extensionContext))]
1261        #[unsafe(method_family = none)]
1262        pub fn extensionContext(&self) -> Option<Retained<NSExtensionContext>>;
1263    );
1264}
1265
1266#[cfg(feature = "UIResponder")]
1267extern_conformance!(
1268    unsafe impl NSExtensionRequestHandling for UIViewController {}
1269);
1270
1271/// UIPresentationController.
1272#[cfg(feature = "UIResponder")]
1273impl UIViewController {
1274    extern_methods!(
1275        #[cfg(feature = "UIPresentationController")]
1276        #[unsafe(method(presentationController))]
1277        #[unsafe(method_family = none)]
1278        pub fn presentationController(&self) -> Option<Retained<UIPresentationController>>;
1279
1280        #[cfg(all(
1281            feature = "UIPresentationController",
1282            feature = "UISheetPresentationController"
1283        ))]
1284        #[unsafe(method(sheetPresentationController))]
1285        #[unsafe(method_family = none)]
1286        pub fn sheetPresentationController(
1287            &self,
1288        ) -> Option<Retained<UISheetPresentationController>>;
1289
1290        #[cfg(all(
1291            feature = "UIPopoverPresentationController",
1292            feature = "UIPresentationController"
1293        ))]
1294        #[unsafe(method(popoverPresentationController))]
1295        #[unsafe(method_family = none)]
1296        pub fn popoverPresentationController(
1297            &self,
1298        ) -> Option<Retained<UIPopoverPresentationController>>;
1299
1300        #[cfg(feature = "UIPresentationController")]
1301        #[unsafe(method(activePresentationController))]
1302        #[unsafe(method_family = none)]
1303        pub fn activePresentationController(&self) -> Option<Retained<UIPresentationController>>;
1304
1305        #[unsafe(method(isModalInPresentation))]
1306        #[unsafe(method_family = none)]
1307        pub fn isModalInPresentation(&self) -> bool;
1308
1309        /// Setter for [`isModalInPresentation`][Self::isModalInPresentation].
1310        #[unsafe(method(setModalInPresentation:))]
1311        #[unsafe(method_family = none)]
1312        pub fn setModalInPresentation(&self, modal_in_presentation: bool);
1313    );
1314}
1315
1316extern_protocol!(
1317    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontrollerpreviewing?language=objc)
1318    pub unsafe trait UIViewControllerPreviewing: NSObjectProtocol + MainThreadOnly {
1319        #[cfg(feature = "UIGestureRecognizer")]
1320        #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1321        #[unsafe(method(previewingGestureRecognizerForFailureRelationship))]
1322        #[unsafe(method_family = none)]
1323        fn previewingGestureRecognizerForFailureRelationship(
1324            &self,
1325        ) -> Retained<UIGestureRecognizer>;
1326
1327        #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1328        #[unsafe(method(delegate))]
1329        #[unsafe(method_family = none)]
1330        fn delegate(&self) -> Retained<ProtocolObject<dyn UIViewControllerPreviewingDelegate>>;
1331
1332        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
1333        #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1334        #[unsafe(method(sourceView))]
1335        #[unsafe(method_family = none)]
1336        fn sourceView(&self) -> Retained<UIView>;
1337
1338        #[cfg(feature = "objc2-core-foundation")]
1339        #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1340        #[unsafe(method(sourceRect))]
1341        #[unsafe(method_family = none)]
1342        fn sourceRect(&self) -> CGRect;
1343
1344        #[cfg(feature = "objc2-core-foundation")]
1345        /// Setter for [`sourceRect`][Self::sourceRect].
1346        #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1347        #[unsafe(method(setSourceRect:))]
1348        #[unsafe(method_family = none)]
1349        fn setSourceRect(&self, source_rect: CGRect);
1350    }
1351);
1352
1353extern_protocol!(
1354    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontrollerpreviewingdelegate?language=objc)
1355    pub unsafe trait UIViewControllerPreviewingDelegate:
1356        NSObjectProtocol + MainThreadOnly
1357    {
1358        #[cfg(all(feature = "UIResponder", feature = "objc2-core-foundation"))]
1359        #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1360        #[unsafe(method(previewingContext:viewControllerForLocation:))]
1361        #[unsafe(method_family = none)]
1362        fn previewingContext_viewControllerForLocation(
1363            &self,
1364            previewing_context: &ProtocolObject<dyn UIViewControllerPreviewing>,
1365            location: CGPoint,
1366        ) -> Option<Retained<UIViewController>>;
1367
1368        #[cfg(feature = "UIResponder")]
1369        #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1370        #[unsafe(method(previewingContext:commitViewController:))]
1371        #[unsafe(method_family = none)]
1372        fn previewingContext_commitViewController(
1373            &self,
1374            previewing_context: &ProtocolObject<dyn UIViewControllerPreviewing>,
1375            view_controller_to_commit: &UIViewController,
1376        );
1377    }
1378);
1379
1380/// UIViewControllerPreviewingRegistration.
1381#[cfg(feature = "UIResponder")]
1382impl UIViewController {
1383    extern_methods!(
1384        #[cfg(feature = "UIView")]
1385        #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1386        #[unsafe(method(registerForPreviewingWithDelegate:sourceView:))]
1387        #[unsafe(method_family = none)]
1388        pub fn registerForPreviewingWithDelegate_sourceView(
1389            &self,
1390            delegate: &ProtocolObject<dyn UIViewControllerPreviewingDelegate>,
1391            source_view: &UIView,
1392        ) -> Retained<ProtocolObject<dyn UIViewControllerPreviewing>>;
1393
1394        #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1395        #[unsafe(method(unregisterForPreviewingWithContext:))]
1396        #[unsafe(method_family = none)]
1397        pub fn unregisterForPreviewingWithContext(
1398            &self,
1399            previewing: &ProtocolObject<dyn UIViewControllerPreviewing>,
1400        );
1401    );
1402}
1403
1404/// UIScreenEdgesDeferringSystemGestures.
1405#[cfg(feature = "UIResponder")]
1406impl UIViewController {
1407    extern_methods!(
1408        #[unsafe(method(childViewControllerForScreenEdgesDeferringSystemGestures))]
1409        #[unsafe(method_family = none)]
1410        pub fn childViewControllerForScreenEdgesDeferringSystemGestures(
1411            &self,
1412        ) -> Option<Retained<UIViewController>>;
1413
1414        #[cfg(feature = "UIGeometry")]
1415        #[unsafe(method(preferredScreenEdgesDeferringSystemGestures))]
1416        #[unsafe(method_family = none)]
1417        pub fn preferredScreenEdgesDeferringSystemGestures(&self) -> UIRectEdge;
1418
1419        #[unsafe(method(setNeedsUpdateOfScreenEdgesDeferringSystemGestures))]
1420        #[unsafe(method_family = none)]
1421        pub fn setNeedsUpdateOfScreenEdgesDeferringSystemGestures(&self);
1422    );
1423}
1424
1425/// UIHomeIndicatorAutoHidden.
1426#[cfg(feature = "UIResponder")]
1427impl UIViewController {
1428    extern_methods!(
1429        #[unsafe(method(childViewControllerForHomeIndicatorAutoHidden))]
1430        #[unsafe(method_family = none)]
1431        pub fn childViewControllerForHomeIndicatorAutoHidden(
1432            &self,
1433        ) -> Option<Retained<UIViewController>>;
1434
1435        #[unsafe(method(prefersHomeIndicatorAutoHidden))]
1436        #[unsafe(method_family = none)]
1437        pub fn prefersHomeIndicatorAutoHidden(&self) -> bool;
1438
1439        #[unsafe(method(setNeedsUpdateOfHomeIndicatorAutoHidden))]
1440        #[unsafe(method_family = none)]
1441        pub fn setNeedsUpdateOfHomeIndicatorAutoHidden(&self);
1442    );
1443}
1444
1445/// UIPointerLockSupport.
1446#[cfg(feature = "UIResponder")]
1447impl UIViewController {
1448    extern_methods!(
1449        #[unsafe(method(childViewControllerForPointerLock))]
1450        #[unsafe(method_family = none)]
1451        pub fn childViewControllerForPointerLock(&self) -> Option<Retained<UIViewController>>;
1452
1453        #[unsafe(method(prefersPointerLocked))]
1454        #[unsafe(method_family = none)]
1455        pub fn prefersPointerLocked(&self) -> bool;
1456
1457        #[unsafe(method(setNeedsUpdateOfPrefersPointerLocked))]
1458        #[unsafe(method_family = none)]
1459        pub fn setNeedsUpdateOfPrefersPointerLocked(&self);
1460    );
1461}
1462
1463#[cfg(feature = "UIResponder")]
1464impl UIViewController {
1465    extern_methods!(
1466        #[cfg(feature = "UIContentConfiguration")]
1467        /// Setting a content unavailable configuration replaces the existing content unavailable view of the view controller with a new content unavailable view instance from the configuration,
1468        /// or directly applies the configuration to the existing content unavailable view if the configuration is compatible with the existing content unavailable view type.
1469        /// The default value is nil.
1470        #[unsafe(method(contentUnavailableConfiguration))]
1471        #[unsafe(method_family = none)]
1472        pub fn contentUnavailableConfiguration(
1473            &self,
1474        ) -> Option<Retained<ProtocolObject<dyn UIContentConfiguration>>>;
1475
1476        #[cfg(feature = "UIContentConfiguration")]
1477        /// Setter for [`contentUnavailableConfiguration`][Self::contentUnavailableConfiguration].
1478        ///
1479        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1480        #[unsafe(method(setContentUnavailableConfiguration:))]
1481        #[unsafe(method_family = none)]
1482        pub fn setContentUnavailableConfiguration(
1483            &self,
1484            content_unavailable_configuration: Option<&ProtocolObject<dyn UIContentConfiguration>>,
1485        );
1486
1487        #[cfg(feature = "UIContentUnavailableConfigurationState")]
1488        /// Returns the current content unavailable configuration state for the view.
1489        /// To add your own custom state(s), override the getter and call super to obtain an instance with the
1490        /// system properties set, then set your own custom states as desired.
1491        #[unsafe(method(contentUnavailableConfigurationState))]
1492        #[unsafe(method_family = none)]
1493        pub fn contentUnavailableConfigurationState(
1494            &self,
1495        ) -> Retained<UIContentUnavailableConfigurationState>;
1496
1497        /// Requests the view update its content unavailable configuration for its current state. This method is called automatically
1498        /// when the view's `contentUnavailableConfigurationState` may have changed, as well as in other circumstances where an
1499        /// update may be required. Multiple requests may be coalesced into a single update at the appropriate time.
1500        #[unsafe(method(setNeedsUpdateContentUnavailableConfiguration))]
1501        #[unsafe(method_family = none)]
1502        pub fn setNeedsUpdateContentUnavailableConfiguration(&self);
1503
1504        #[cfg(feature = "UIContentUnavailableConfigurationState")]
1505        /// Subclasses should override this method and update the content unavailable's configuration using the state provided.
1506        /// This method should not be called directly, use `setNeedsUpdateContentUnavailableConfiguration` to request an update.
1507        #[unsafe(method(updateContentUnavailableConfigurationUsingState:))]
1508        #[unsafe(method_family = none)]
1509        pub fn updateContentUnavailableConfigurationUsingState(
1510            &self,
1511            state: &UIContentUnavailableConfigurationState,
1512        );
1513    );
1514}
1515
1516#[cfg(feature = "UIResponder")]
1517impl UIViewController {
1518    extern_methods!(
1519        /// Override to return a child view controller or nil. If non-nil, that view controller's preference for interface orientation lock will be used. If nil, `self` is used.
1520        /// Whenever the return value changes, call `setNeedsUpdateOfPrefersInterfaceOrientationLocked()`.
1521        #[unsafe(method(childViewControllerForInterfaceOrientationLock))]
1522        #[unsafe(method_family = none)]
1523        pub fn childViewControllerForInterfaceOrientationLock(
1524            &self,
1525        ) -> Option<Retained<UIViewController>>;
1526
1527        /// Whether this view controller prefers the scene's interface orientation to be locked when shown. The default is `NO`. Note that this preference may or may not be honored.
1528        /// See `UIWindowScene.Geometry` for the current state of interface orientation lock.
1529        #[unsafe(method(prefersInterfaceOrientationLocked))]
1530        #[unsafe(method_family = none)]
1531        pub fn prefersInterfaceOrientationLocked(&self) -> bool;
1532
1533        /// Call whenever the view controller's preference for interface orientation lock has changed
1534        #[unsafe(method(setNeedsUpdateOfPrefersInterfaceOrientationLocked))]
1535        #[unsafe(method_family = none)]
1536        pub fn setNeedsUpdateOfPrefersInterfaceOrientationLocked(&self);
1537    );
1538}
1539
1540#[cfg(feature = "UIResponder")]
1541impl UIViewController {
1542    extern_methods!(
1543        #[deprecated = "UIViewControllerPreviewing is deprecated. Please use UIContextMenuInteraction."]
1544        #[unsafe(method(previewActionItems))]
1545        #[unsafe(method_family = none)]
1546        pub fn previewActionItems(
1547            &self,
1548        ) -> Retained<NSArray<ProtocolObject<dyn UIPreviewActionItem>>>;
1549    );
1550}
1551
1552#[cfg(feature = "UIResponder")]
1553impl UIViewController {
1554    extern_methods!(
1555        #[cfg(feature = "UITraitCollection")]
1556        #[unsafe(method(traitOverrides))]
1557        #[unsafe(method_family = none)]
1558        pub fn traitOverrides(&self) -> Retained<ProtocolObject<dyn UITraitOverrides>>;
1559
1560        /// Forces an immediate trait update for this view controller and its view, including any view
1561        /// controllers and views in this subtree. Any trait change callbacks are sent synchronously.
1562        #[unsafe(method(updateTraitsIfNeeded))]
1563        #[unsafe(method_family = none)]
1564        pub fn updateTraitsIfNeeded(&self);
1565    );
1566}
1567
1568#[cfg(all(feature = "UIResponder", feature = "UITraitCollection"))]
1569extern_conformance!(
1570    unsafe impl UITraitChangeObservable for UIViewController {}
1571);
1572
1573/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicontainerbackgroundstyle?language=objc)
1574// NS_ENUM
1575#[repr(transparent)]
1576#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1577pub struct UIContainerBackgroundStyle(pub NSInteger);
1578impl UIContainerBackgroundStyle {
1579    #[doc(alias = "UIContainerBackgroundStyleAutomatic")]
1580    pub const Automatic: Self = Self(0);
1581    #[doc(alias = "UIContainerBackgroundStyleGlass")]
1582    pub const Glass: Self = Self(1);
1583    #[doc(alias = "UIContainerBackgroundStyleHidden")]
1584    pub const Hidden: Self = Self(2);
1585}
1586
1587unsafe impl Encode for UIContainerBackgroundStyle {
1588    const ENCODING: Encoding = NSInteger::ENCODING;
1589}
1590
1591unsafe impl RefEncode for UIContainerBackgroundStyle {
1592    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1593}
1594
1595#[cfg(feature = "UIResponder")]
1596impl UIViewController {
1597    extern_methods!(
1598        #[unsafe(method(preferredContainerBackgroundStyle))]
1599        #[unsafe(method_family = none)]
1600        pub fn preferredContainerBackgroundStyle(&self) -> UIContainerBackgroundStyle;
1601
1602        #[unsafe(method(childViewControllerForPreferredContainerBackgroundStyle))]
1603        #[unsafe(method_family = none)]
1604        pub fn childViewControllerForPreferredContainerBackgroundStyle(
1605            &self,
1606        ) -> Option<Retained<UIViewController>>;
1607
1608        #[unsafe(method(setNeedsUpdateOfPreferredContainerBackgroundStyle))]
1609        #[unsafe(method_family = none)]
1610        pub fn setNeedsUpdateOfPreferredContainerBackgroundStyle(&self);
1611    );
1612}
1613
1614extern_protocol!(
1615    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipreviewactionitem?language=objc)
1616    pub unsafe trait UIPreviewActionItem: NSObjectProtocol + MainThreadOnly {
1617        #[unsafe(method(title))]
1618        #[unsafe(method_family = none)]
1619        fn title(&self) -> Retained<NSString>;
1620    }
1621);
1622
1623/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipreviewactionstyle?language=objc)
1624// NS_ENUM
1625#[deprecated = "Please use UIContextMenuInteraction."]
1626#[repr(transparent)]
1627#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1628pub struct UIPreviewActionStyle(pub NSInteger);
1629impl UIPreviewActionStyle {
1630    #[doc(alias = "UIPreviewActionStyleDefault")]
1631    #[deprecated = "Please use UIContextMenuInteraction."]
1632    pub const Default: Self = Self(0);
1633    #[doc(alias = "UIPreviewActionStyleSelected")]
1634    #[deprecated = "Please use UIContextMenuInteraction."]
1635    pub const Selected: Self = Self(1);
1636    #[doc(alias = "UIPreviewActionStyleDestructive")]
1637    #[deprecated = "Please use UIContextMenuInteraction."]
1638    pub const Destructive: Self = Self(2);
1639}
1640
1641unsafe impl Encode for UIPreviewActionStyle {
1642    const ENCODING: Encoding = NSInteger::ENCODING;
1643}
1644
1645unsafe impl RefEncode for UIPreviewActionStyle {
1646    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1647}
1648
1649extern_class!(
1650    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipreviewaction?language=objc)
1651    #[unsafe(super(NSObject))]
1652    #[thread_kind = MainThreadOnly]
1653    #[derive(Debug, PartialEq, Eq, Hash)]
1654    #[deprecated = "Please use UIContextMenuInteraction."]
1655    pub struct UIPreviewAction;
1656);
1657
1658extern_conformance!(
1659    unsafe impl NSCopying for UIPreviewAction {}
1660);
1661
1662unsafe impl CopyingHelper for UIPreviewAction {
1663    type Result = Self;
1664}
1665
1666extern_conformance!(
1667    unsafe impl NSObjectProtocol for UIPreviewAction {}
1668);
1669
1670extern_conformance!(
1671    unsafe impl UIPreviewActionItem for UIPreviewAction {}
1672);
1673
1674impl UIPreviewAction {
1675    extern_methods!(
1676        #[cfg(all(feature = "UIResponder", feature = "block2"))]
1677        /// # Safety
1678        ///
1679        /// - The returned block's argument 1 must be a valid pointer.
1680        /// - The returned block's argument 2 must be a valid pointer.
1681        #[unsafe(method(handler))]
1682        #[unsafe(method_family = none)]
1683        pub unsafe fn handler(
1684            &self,
1685        ) -> NonNull<
1686            block2::DynBlock<
1687                dyn Fn(NonNull<ProtocolObject<dyn UIPreviewActionItem>>, NonNull<UIViewController>),
1688            >,
1689        >;
1690
1691        #[cfg(all(feature = "UIResponder", feature = "block2"))]
1692        #[unsafe(method(actionWithTitle:style:handler:))]
1693        #[unsafe(method_family = none)]
1694        pub fn actionWithTitle_style_handler(
1695            title: &NSString,
1696            style: UIPreviewActionStyle,
1697            handler: &block2::DynBlock<dyn Fn(NonNull<UIPreviewAction>, NonNull<UIViewController>)>,
1698            mtm: MainThreadMarker,
1699        ) -> Retained<Self>;
1700    );
1701}
1702
1703/// Methods declared on superclass `NSObject`.
1704impl UIPreviewAction {
1705    extern_methods!(
1706        #[unsafe(method(init))]
1707        #[unsafe(method_family = init)]
1708        pub fn init(this: Allocated<Self>) -> Retained<Self>;
1709
1710        #[unsafe(method(new))]
1711        #[unsafe(method_family = new)]
1712        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
1713    );
1714}
1715
1716extern_class!(
1717    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipreviewactiongroup?language=objc)
1718    #[unsafe(super(NSObject))]
1719    #[thread_kind = MainThreadOnly]
1720    #[derive(Debug, PartialEq, Eq, Hash)]
1721    #[deprecated = "Please use UIContextMenuInteraction."]
1722    pub struct UIPreviewActionGroup;
1723);
1724
1725extern_conformance!(
1726    unsafe impl NSCopying for UIPreviewActionGroup {}
1727);
1728
1729unsafe impl CopyingHelper for UIPreviewActionGroup {
1730    type Result = Self;
1731}
1732
1733extern_conformance!(
1734    unsafe impl NSObjectProtocol for UIPreviewActionGroup {}
1735);
1736
1737extern_conformance!(
1738    unsafe impl UIPreviewActionItem for UIPreviewActionGroup {}
1739);
1740
1741impl UIPreviewActionGroup {
1742    extern_methods!(
1743        #[unsafe(method(actionGroupWithTitle:style:actions:))]
1744        #[unsafe(method_family = none)]
1745        pub fn actionGroupWithTitle_style_actions(
1746            title: &NSString,
1747            style: UIPreviewActionStyle,
1748            actions: &NSArray<UIPreviewAction>,
1749            mtm: MainThreadMarker,
1750        ) -> Retained<Self>;
1751    );
1752}
1753
1754/// Methods declared on superclass `NSObject`.
1755impl UIPreviewActionGroup {
1756    extern_methods!(
1757        #[unsafe(method(init))]
1758        #[unsafe(method_family = init)]
1759        pub fn init(this: Allocated<Self>) -> Retained<Self>;
1760
1761        #[unsafe(method(new))]
1762        #[unsafe(method_family = new)]
1763        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
1764    );
1765}