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        unsafe fn containerView(&self) -> Retained<UIView>;
47
48        #[unsafe(method(isAnimated))]
49        #[unsafe(method_family = none)]
50        unsafe fn isAnimated(&self) -> bool;
51
52        #[unsafe(method(isInteractive))]
53        #[unsafe(method_family = none)]
54        unsafe fn isInteractive(&self) -> bool;
55
56        #[unsafe(method(transitionWasCancelled))]
57        #[unsafe(method_family = none)]
58        unsafe fn transitionWasCancelled(&self) -> bool;
59
60        #[cfg(feature = "UIViewController")]
61        #[unsafe(method(presentationStyle))]
62        #[unsafe(method_family = none)]
63        unsafe fn presentationStyle(&self) -> UIModalPresentationStyle;
64
65        #[cfg(feature = "objc2-core-foundation")]
66        #[unsafe(method(updateInteractiveTransition:))]
67        #[unsafe(method_family = none)]
68        unsafe fn updateInteractiveTransition(&self, percent_complete: CGFloat);
69
70        #[unsafe(method(finishInteractiveTransition))]
71        #[unsafe(method_family = none)]
72        unsafe fn finishInteractiveTransition(&self);
73
74        #[unsafe(method(cancelInteractiveTransition))]
75        #[unsafe(method_family = none)]
76        unsafe fn cancelInteractiveTransition(&self);
77
78        #[unsafe(method(pauseInteractiveTransition))]
79        #[unsafe(method_family = none)]
80        unsafe fn pauseInteractiveTransition(&self);
81
82        #[unsafe(method(completeTransition:))]
83        #[unsafe(method_family = none)]
84        unsafe 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        unsafe 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        unsafe 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        unsafe 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        unsafe 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        unsafe 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        unsafe fn transitionDuration(
140            &self,
141            transition_context: Option<&ProtocolObject<dyn UIViewControllerContextTransitioning>>,
142        ) -> NSTimeInterval;
143
144        #[unsafe(method(animateTransition:))]
145        #[unsafe(method_family = none)]
146        unsafe 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        unsafe 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        unsafe 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        unsafe 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        unsafe fn completionSpeed(&self) -> CGFloat;
188
189        #[cfg(feature = "UIView")]
190        #[optional]
191        #[unsafe(method(completionCurve))]
192        #[unsafe(method_family = none)]
193        unsafe 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        unsafe 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        unsafe 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        unsafe 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        unsafe 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        unsafe 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        unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe fn timingCurve(
334            &self,
335        ) -> Option<Retained<ProtocolObject<dyn UITimingCurveProvider>>>;
336
337        #[cfg(feature = "UITimingCurveProvider")]
338        /// Setter for [`timingCurve`][Self::timingCurve].
339        #[unsafe(method(setTimingCurve:))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn setTimingCurve(
342            &self,
343            timing_curve: Option<&ProtocolObject<dyn UITimingCurveProvider>>,
344        );
345
346        /// Set this to NO in order to start an interruptible transition non
347        /// interactively. By default this is YES, which is consistent with the behavior
348        /// before 10.0.
349        #[unsafe(method(wantsInteractiveStart))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn wantsInteractiveStart(&self) -> bool;
352
353        /// Setter for [`wantsInteractiveStart`][Self::wantsInteractiveStart].
354        #[unsafe(method(setWantsInteractiveStart:))]
355        #[unsafe(method_family = none)]
356        pub unsafe fn setWantsInteractiveStart(&self, wants_interactive_start: bool);
357
358        /// Use this method to pause a running interruptible animator. This will ensure that all blocks
359        /// provided by a transition coordinator's notifyWhenInteractionChangesUsingBlock: method
360        /// are executed when a transition moves in and out of an interactive mode.
361        #[unsafe(method(pauseInteractiveTransition))]
362        #[unsafe(method_family = none)]
363        pub unsafe fn pauseInteractiveTransition(&self);
364
365        #[cfg(feature = "objc2-core-foundation")]
366        #[unsafe(method(updateInteractiveTransition:))]
367        #[unsafe(method_family = none)]
368        pub unsafe fn updateInteractiveTransition(&self, percent_complete: CGFloat);
369
370        #[unsafe(method(cancelInteractiveTransition))]
371        #[unsafe(method_family = none)]
372        pub unsafe fn cancelInteractiveTransition(&self);
373
374        #[unsafe(method(finishInteractiveTransition))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn finishInteractiveTransition(&self);
377    );
378}
379
380/// Methods declared on superclass `NSObject`.
381impl UIPercentDrivenInteractiveTransition {
382    extern_methods!(
383        #[unsafe(method(init))]
384        #[unsafe(method_family = init)]
385        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
386
387        #[unsafe(method(new))]
388        #[unsafe(method_family = new)]
389        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
390    );
391}