objc2_ui_kit/generated/
UIViewControllerTransitioning.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
12extern "C" {
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitransitioncontextfromviewcontrollerkey?language=objc)
14    #[cfg(feature = "UIViewControllerTransitionCoordinator")]
15    pub static UITransitionContextFromViewControllerKey:
16        &'static UITransitionContextViewControllerKey;
17}
18
19extern "C" {
20    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitransitioncontexttoviewcontrollerkey?language=objc)
21    #[cfg(feature = "UIViewControllerTransitionCoordinator")]
22    pub static UITransitionContextToViewControllerKey:
23        &'static UITransitionContextViewControllerKey;
24}
25
26extern "C" {
27    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitransitioncontextfromviewkey?language=objc)
28    #[cfg(feature = "UIViewControllerTransitionCoordinator")]
29    pub static UITransitionContextFromViewKey: &'static UITransitionContextViewKey;
30}
31
32extern "C" {
33    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitransitioncontexttoviewkey?language=objc)
34    #[cfg(feature = "UIViewControllerTransitionCoordinator")]
35    pub static UITransitionContextToViewKey: &'static UITransitionContextViewKey;
36}
37
38extern_protocol!(
39    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontrollercontexttransitioning?language=objc)
40    pub unsafe trait UIViewControllerContextTransitioning:
41        NSObjectProtocol + MainThreadOnly
42    {
43        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
44        #[unsafe(method(containerView))]
45        #[unsafe(method_family = none)]
46        fn containerView(&self) -> Retained<UIView>;
47
48        #[unsafe(method(isAnimated))]
49        #[unsafe(method_family = none)]
50        fn isAnimated(&self) -> bool;
51
52        #[unsafe(method(isInteractive))]
53        #[unsafe(method_family = none)]
54        fn isInteractive(&self) -> bool;
55
56        #[unsafe(method(transitionWasCancelled))]
57        #[unsafe(method_family = none)]
58        fn transitionWasCancelled(&self) -> bool;
59
60        #[cfg(feature = "UIViewController")]
61        #[unsafe(method(presentationStyle))]
62        #[unsafe(method_family = none)]
63        fn presentationStyle(&self) -> UIModalPresentationStyle;
64
65        #[cfg(feature = "objc2-core-foundation")]
66        #[unsafe(method(updateInteractiveTransition:))]
67        #[unsafe(method_family = none)]
68        fn updateInteractiveTransition(&self, percent_complete: CGFloat);
69
70        #[unsafe(method(finishInteractiveTransition))]
71        #[unsafe(method_family = none)]
72        fn finishInteractiveTransition(&self);
73
74        #[unsafe(method(cancelInteractiveTransition))]
75        #[unsafe(method_family = none)]
76        fn cancelInteractiveTransition(&self);
77
78        #[unsafe(method(pauseInteractiveTransition))]
79        #[unsafe(method_family = none)]
80        fn pauseInteractiveTransition(&self);
81
82        #[unsafe(method(completeTransition:))]
83        #[unsafe(method_family = none)]
84        fn completeTransition(&self, did_complete: bool);
85
86        #[cfg(all(
87            feature = "UIResponder",
88            feature = "UIViewController",
89            feature = "UIViewControllerTransitionCoordinator"
90        ))]
91        #[unsafe(method(viewControllerForKey:))]
92        #[unsafe(method_family = none)]
93        fn viewControllerForKey(
94            &self,
95            key: &UITransitionContextViewControllerKey,
96        ) -> Option<Retained<UIViewController>>;
97
98        #[cfg(all(
99            feature = "UIResponder",
100            feature = "UIView",
101            feature = "UIViewControllerTransitionCoordinator"
102        ))]
103        #[unsafe(method(viewForKey:))]
104        #[unsafe(method_family = none)]
105        fn viewForKey(&self, key: &UITransitionContextViewKey) -> Option<Retained<UIView>>;
106
107        #[cfg(feature = "objc2-core-foundation")]
108        #[unsafe(method(targetTransform))]
109        #[unsafe(method_family = none)]
110        fn targetTransform(&self) -> CGAffineTransform;
111
112        #[cfg(all(
113            feature = "UIResponder",
114            feature = "UIViewController",
115            feature = "objc2-core-foundation"
116        ))]
117        #[unsafe(method(initialFrameForViewController:))]
118        #[unsafe(method_family = none)]
119        fn initialFrameForViewController(&self, vc: &UIViewController) -> CGRect;
120
121        #[cfg(all(
122            feature = "UIResponder",
123            feature = "UIViewController",
124            feature = "objc2-core-foundation"
125        ))]
126        #[unsafe(method(finalFrameForViewController:))]
127        #[unsafe(method_family = none)]
128        fn finalFrameForViewController(&self, vc: &UIViewController) -> CGRect;
129    }
130);
131
132extern_protocol!(
133    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontrolleranimatedtransitioning?language=objc)
134    pub unsafe trait UIViewControllerAnimatedTransitioning:
135        NSObjectProtocol + MainThreadOnly
136    {
137        #[unsafe(method(transitionDuration:))]
138        #[unsafe(method_family = none)]
139        fn transitionDuration(
140            &self,
141            transition_context: Option<&ProtocolObject<dyn UIViewControllerContextTransitioning>>,
142        ) -> NSTimeInterval;
143
144        #[unsafe(method(animateTransition:))]
145        #[unsafe(method_family = none)]
146        fn animateTransition(
147            &self,
148            transition_context: &ProtocolObject<dyn UIViewControllerContextTransitioning>,
149        );
150
151        #[cfg(feature = "UIViewAnimating")]
152        /// A conforming object implements this method if the transition it creates can
153        /// be interrupted. For example, it could return an instance of a
154        /// UIViewPropertyAnimator. It is expected that this method will return the same
155        /// instance for the life of a transition.
156        #[optional]
157        #[unsafe(method(interruptibleAnimatorForTransition:))]
158        #[unsafe(method_family = none)]
159        fn interruptibleAnimatorForTransition(
160            &self,
161            transition_context: &ProtocolObject<dyn UIViewControllerContextTransitioning>,
162        ) -> Retained<ProtocolObject<dyn UIViewImplicitlyAnimating>>;
163
164        #[optional]
165        #[unsafe(method(animationEnded:))]
166        #[unsafe(method_family = none)]
167        fn animationEnded(&self, transition_completed: bool);
168    }
169);
170
171extern_protocol!(
172    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontrollerinteractivetransitioning?language=objc)
173    pub unsafe trait UIViewControllerInteractiveTransitioning:
174        NSObjectProtocol + MainThreadOnly
175    {
176        #[unsafe(method(startInteractiveTransition:))]
177        #[unsafe(method_family = none)]
178        fn startInteractiveTransition(
179            &self,
180            transition_context: &ProtocolObject<dyn UIViewControllerContextTransitioning>,
181        );
182
183        #[cfg(feature = "objc2-core-foundation")]
184        #[optional]
185        #[unsafe(method(completionSpeed))]
186        #[unsafe(method_family = none)]
187        fn completionSpeed(&self) -> CGFloat;
188
189        #[cfg(feature = "UIView")]
190        #[optional]
191        #[unsafe(method(completionCurve))]
192        #[unsafe(method_family = none)]
193        fn completionCurve(&self) -> UIViewAnimationCurve;
194
195        /// In 10.0, if an object conforming to UIViewControllerAnimatedTransitioning is
196        /// known to be interruptible, it is possible to start it as if it was not
197        /// interactive and then interrupt the transition and interact with it. In this
198        /// case, implement this method and return NO. If an interactor does not
199        /// implement this method, YES is assumed.
200        #[optional]
201        #[unsafe(method(wantsInteractiveStart))]
202        #[unsafe(method_family = none)]
203        fn wantsInteractiveStart(&self) -> bool;
204    }
205);
206
207extern_protocol!(
208    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontrollertransitioningdelegate?language=objc)
209    pub unsafe trait UIViewControllerTransitioningDelegate:
210        NSObjectProtocol + MainThreadOnly
211    {
212        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
213        #[optional]
214        #[unsafe(method(animationControllerForPresentedController:presentingController:sourceController:))]
215        #[unsafe(method_family = none)]
216        fn animationControllerForPresentedController_presentingController_sourceController(
217            &self,
218            presented: &UIViewController,
219            presenting: &UIViewController,
220            source: &UIViewController,
221        ) -> Option<Retained<ProtocolObject<dyn UIViewControllerAnimatedTransitioning>>>;
222
223        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
224        #[optional]
225        #[unsafe(method(animationControllerForDismissedController:))]
226        #[unsafe(method_family = none)]
227        fn animationControllerForDismissedController(
228            &self,
229            dismissed: &UIViewController,
230        ) -> Option<Retained<ProtocolObject<dyn UIViewControllerAnimatedTransitioning>>>;
231
232        #[optional]
233        #[unsafe(method(interactionControllerForPresentation:))]
234        #[unsafe(method_family = none)]
235        fn interactionControllerForPresentation(
236            &self,
237            animator: &ProtocolObject<dyn UIViewControllerAnimatedTransitioning>,
238        ) -> Option<Retained<ProtocolObject<dyn UIViewControllerInteractiveTransitioning>>>;
239
240        #[optional]
241        #[unsafe(method(interactionControllerForDismissal:))]
242        #[unsafe(method_family = none)]
243        fn interactionControllerForDismissal(
244            &self,
245            animator: &ProtocolObject<dyn UIViewControllerAnimatedTransitioning>,
246        ) -> Option<Retained<ProtocolObject<dyn UIViewControllerInteractiveTransitioning>>>;
247
248        #[cfg(all(
249            feature = "UIPresentationController",
250            feature = "UIResponder",
251            feature = "UIViewController"
252        ))]
253        #[optional]
254        #[unsafe(method(presentationControllerForPresentedViewController:presentingViewController:sourceViewController:))]
255        #[unsafe(method_family = none)]
256        fn presentationControllerForPresentedViewController_presentingViewController_sourceViewController(
257            &self,
258            presented: &UIViewController,
259            presenting: Option<&UIViewController>,
260            source: &UIViewController,
261        ) -> Option<Retained<UIPresentationController>>;
262    }
263);
264
265extern_class!(
266    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipercentdriveninteractivetransition?language=objc)
267    #[unsafe(super(NSObject))]
268    #[thread_kind = MainThreadOnly]
269    #[derive(Debug, PartialEq, Eq, Hash)]
270    pub struct UIPercentDrivenInteractiveTransition;
271);
272
273extern_conformance!(
274    unsafe impl NSObjectProtocol for UIPercentDrivenInteractiveTransition {}
275);
276
277extern_conformance!(
278    unsafe impl UIViewControllerInteractiveTransitioning for UIPercentDrivenInteractiveTransition {}
279);
280
281impl UIPercentDrivenInteractiveTransition {
282    extern_methods!(
283        #[cfg(feature = "objc2-core-foundation")]
284        /// This is the non-interactive duration that was returned when the
285        /// animators transitionDuration: method was called when the transition started.
286        #[unsafe(method(duration))]
287        #[unsafe(method_family = none)]
288        pub fn duration(&self) -> CGFloat;
289
290        #[cfg(feature = "objc2-core-foundation")]
291        /// The last percentComplete value specified by updateInteractiveTransition:
292        #[unsafe(method(percentComplete))]
293        #[unsafe(method_family = none)]
294        pub fn percentComplete(&self) -> CGFloat;
295
296        #[cfg(feature = "objc2-core-foundation")]
297        /// completionSpeed defaults to 1.0 which corresponds to a completion duration of
298        /// (1 - percentComplete)*duration.  It must be greater than 0.0. The actual
299        /// completion is inversely proportional to the completionSpeed.  This can be set
300        /// before cancelInteractiveTransition or finishInteractiveTransition is called
301        /// in order to speed up or slow down the non interactive part of the
302        /// transition.
303        #[unsafe(method(completionSpeed))]
304        #[unsafe(method_family = none)]
305        pub fn completionSpeed(&self) -> CGFloat;
306
307        #[cfg(feature = "objc2-core-foundation")]
308        /// Setter for [`completionSpeed`][Self::completionSpeed].
309        #[unsafe(method(setCompletionSpeed:))]
310        #[unsafe(method_family = none)]
311        pub fn setCompletionSpeed(&self, completion_speed: CGFloat);
312
313        #[cfg(feature = "UIView")]
314        /// When the interactive part of the transition has completed, this property can
315        /// be set to indicate a different animation curve. It defaults to UIViewAnimationCurveEaseInOut.
316        /// Note that during the interactive portion of the animation the timing curve is linear.
317        #[unsafe(method(completionCurve))]
318        #[unsafe(method_family = none)]
319        pub fn completionCurve(&self) -> UIViewAnimationCurve;
320
321        #[cfg(feature = "UIView")]
322        /// Setter for [`completionCurve`][Self::completionCurve].
323        #[unsafe(method(setCompletionCurve:))]
324        #[unsafe(method_family = none)]
325        pub fn setCompletionCurve(&self, completion_curve: UIViewAnimationCurve);
326
327        #[cfg(feature = "UITimingCurveProvider")]
328        /// For an interruptible animator, one can specify a different timing curve provider to use when the
329        /// transition is continued. This property is ignored if the animated transitioning object does not
330        /// vend an interruptible animator.
331        #[unsafe(method(timingCurve))]
332        #[unsafe(method_family = none)]
333        pub fn timingCurve(&self) -> Option<Retained<ProtocolObject<dyn UITimingCurveProvider>>>;
334
335        #[cfg(feature = "UITimingCurveProvider")]
336        /// Setter for [`timingCurve`][Self::timingCurve].
337        #[unsafe(method(setTimingCurve:))]
338        #[unsafe(method_family = none)]
339        pub fn setTimingCurve(
340            &self,
341            timing_curve: Option<&ProtocolObject<dyn UITimingCurveProvider>>,
342        );
343
344        /// Set this to NO in order to start an interruptible transition non
345        /// interactively. By default this is YES, which is consistent with the behavior
346        /// before 10.0.
347        #[unsafe(method(wantsInteractiveStart))]
348        #[unsafe(method_family = none)]
349        pub fn wantsInteractiveStart(&self) -> bool;
350
351        /// Setter for [`wantsInteractiveStart`][Self::wantsInteractiveStart].
352        #[unsafe(method(setWantsInteractiveStart:))]
353        #[unsafe(method_family = none)]
354        pub fn setWantsInteractiveStart(&self, wants_interactive_start: bool);
355
356        /// Use this method to pause a running interruptible animator. This will ensure that all blocks
357        /// provided by a transition coordinator's notifyWhenInteractionChangesUsingBlock: method
358        /// are executed when a transition moves in and out of an interactive mode.
359        #[unsafe(method(pauseInteractiveTransition))]
360        #[unsafe(method_family = none)]
361        pub fn pauseInteractiveTransition(&self);
362
363        #[cfg(feature = "objc2-core-foundation")]
364        #[unsafe(method(updateInteractiveTransition:))]
365        #[unsafe(method_family = none)]
366        pub fn updateInteractiveTransition(&self, percent_complete: CGFloat);
367
368        #[unsafe(method(cancelInteractiveTransition))]
369        #[unsafe(method_family = none)]
370        pub fn cancelInteractiveTransition(&self);
371
372        #[unsafe(method(finishInteractiveTransition))]
373        #[unsafe(method_family = none)]
374        pub fn finishInteractiveTransition(&self);
375    );
376}
377
378/// Methods declared on superclass `NSObject`.
379impl UIPercentDrivenInteractiveTransition {
380    extern_methods!(
381        #[unsafe(method(init))]
382        #[unsafe(method_family = init)]
383        pub fn init(this: Allocated<Self>) -> Retained<Self>;
384
385        #[unsafe(method(new))]
386        #[unsafe(method_family = new)]
387        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
388    );
389}