objc2_ui_kit/generated/
UIViewControllerTransition.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8extern_class!(
9    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontrollertransition?language=objc)
10    #[unsafe(super(NSObject))]
11    #[derive(Debug, PartialEq, Eq, Hash)]
12    pub struct UIViewControllerTransition;
13);
14
15extern_conformance!(
16    unsafe impl NSObjectProtocol for UIViewControllerTransition {}
17);
18
19impl UIViewControllerTransition {
20    extern_methods!(
21        #[cfg(all(
22            feature = "UIResponder",
23            feature = "UIView",
24            feature = "UIZoomTransitionOptions",
25            feature = "block2"
26        ))]
27        /// Zoom from the view provided by the `sourceViewProvider` to the presented or pushed view controller's view.
28        /// The transition's `sourceViewProvider` is called whenever the transition needs to request a source view.
29        /// Note that it may be called multiple times during the transition's lifecycle in order
30        /// to ensure that the transition incorporates the most up-to-date visuals.
31        ///
32        /// **Example**
33        ///
34        /// Consider an interface where a user may tap a cell representing a city to present a detail view.
35        /// In the detail view, they may swipe left or right to go to the next city in the list. When the detail view
36        /// is dismissed, it should un-zoom to the currently selected city rather than the one that was first selected.
37        /// ```text
38        /// cityViewController.preferredTransition = .zoom { context in
39        /// let displayed = context.displayedViewController as! CityViewController
40        /// let source = context.sourceViewController as! CityListViewController
41        /// return source.cell(for: displayed.cityId)
42        /// }
43        /// present(cityViewController, animated: true)
44        /// ```
45        ///
46        /// # Safety
47        ///
48        /// `source_view_provider` block's return must be a valid pointer or null.
49        #[unsafe(method(zoomWithOptions:sourceViewProvider:))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn zoomWithOptions_sourceViewProvider(
52            options: Option<&UIZoomTransitionOptions>,
53            source_view_provider: &block2::DynBlock<
54                dyn Fn(NonNull<UIZoomTransitionSourceViewProviderContext>) -> *mut UIView,
55            >,
56        ) -> Retained<Self>;
57
58        #[cfg(all(
59            feature = "UIBarButtonItem",
60            feature = "UIBarItem",
61            feature = "UIZoomTransitionOptions",
62            feature = "block2"
63        ))]
64        /// Zoom from the `UIBarButtonItem` provided by the `sourceBarButtonItemProvider` to the presented or pushed view controller's view.
65        ///
66        /// # Safety
67        ///
68        /// `source_bar_button_item_provider` block's return must be a valid pointer or null.
69        #[unsafe(method(zoomWithOptions:sourceBarButtonItemProvider:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn zoomWithOptions_sourceBarButtonItemProvider(
72            options: Option<&UIZoomTransitionOptions>,
73            source_bar_button_item_provider: &block2::DynBlock<
74                dyn Fn(NonNull<UIZoomTransitionSourceViewProviderContext>) -> *mut UIBarButtonItem,
75            >,
76        ) -> Retained<Self>;
77
78        /// View slides up from the bottom of the screen. Same as `UIModalTransitionStyle.coverVertical`.
79        #[unsafe(method(coverVerticalTransition))]
80        #[unsafe(method_family = none)]
81        pub fn coverVerticalTransition() -> Retained<Self>;
82
83        /// View flips horizontally in 3D. Same as `UIModalTransitionStyle.flipHorizontal`.
84        #[unsafe(method(flipHorizontalTransition))]
85        #[unsafe(method_family = none)]
86        pub fn flipHorizontalTransition() -> Retained<Self>;
87
88        /// Fades out the current view while fading in the new view. Same as `UIModalTransitionStyle.crossDissolve`.
89        #[unsafe(method(crossDissolveTransition))]
90        #[unsafe(method_family = none)]
91        pub fn crossDissolveTransition() -> Retained<Self>;
92
93        /// One corner of the current view curls up to reveal the presented view underneath. Same as `UIModalTransitionStyle.partialCurl`.
94        #[unsafe(method(partialCurlTransition))]
95        #[unsafe(method_family = none)]
96        pub fn partialCurlTransition() -> Retained<Self>;
97
98        #[unsafe(method(init))]
99        #[unsafe(method_family = init)]
100        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
101
102        #[unsafe(method(new))]
103        #[unsafe(method_family = new)]
104        pub unsafe fn new() -> Retained<Self>;
105    );
106}
107
108extern_class!(
109    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uizoomtransitionsourceviewprovidercontext?language=objc)
110    #[unsafe(super(NSObject))]
111    #[derive(Debug, PartialEq, Eq, Hash)]
112    pub struct UIZoomTransitionSourceViewProviderContext;
113);
114
115extern_conformance!(
116    unsafe impl NSObjectProtocol for UIZoomTransitionSourceViewProviderContext {}
117);
118
119impl UIZoomTransitionSourceViewProviderContext {
120    extern_methods!(
121        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
122        /// View controller that is the source of the zoom transition.
123        #[unsafe(method(sourceViewController))]
124        #[unsafe(method_family = none)]
125        pub fn sourceViewController(&self, mtm: MainThreadMarker) -> Retained<UIViewController>;
126
127        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
128        /// The view controller being zoomed into by the transition.
129        #[unsafe(method(zoomedViewController))]
130        #[unsafe(method_family = none)]
131        pub fn zoomedViewController(&self, mtm: MainThreadMarker) -> Retained<UIViewController>;
132
133        #[unsafe(method(init))]
134        #[unsafe(method_family = init)]
135        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
136
137        #[unsafe(method(new))]
138        #[unsafe(method_family = new)]
139        pub unsafe fn new() -> Retained<Self>;
140    );
141}