objc2_ui_kit/generated/
UIViewPropertyAnimator.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_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewpropertyanimator?language=objc)
14    #[unsafe(super(NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct UIViewPropertyAnimator;
18);
19
20unsafe impl NSCopying for UIViewPropertyAnimator {}
21
22unsafe impl CopyingHelper for UIViewPropertyAnimator {
23    type Result = Self;
24}
25
26unsafe impl NSObjectProtocol for UIViewPropertyAnimator {}
27
28#[cfg(feature = "UIViewAnimating")]
29unsafe impl UIViewAnimating for UIViewPropertyAnimator {}
30
31#[cfg(feature = "UIViewAnimating")]
32unsafe impl UIViewImplicitlyAnimating for UIViewPropertyAnimator {}
33
34impl UIViewPropertyAnimator {
35    extern_methods!(
36        #[cfg(feature = "UITimingCurveProvider")]
37        #[unsafe(method(timingParameters))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn timingParameters(
40            &self,
41        ) -> Option<Retained<ProtocolObject<dyn UITimingCurveProvider>>>;
42
43        #[unsafe(method(duration))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn duration(&self) -> NSTimeInterval;
46
47        /// Defaults to 0. This property is set when calling -[UIView startAnimationAfterDelay:].
48        #[unsafe(method(delay))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn delay(&self) -> NSTimeInterval;
51
52        /// Defaults to YES. Raises if set on an active animator.
53        #[unsafe(method(isUserInteractionEnabled))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn isUserInteractionEnabled(&self) -> bool;
56
57        /// Setter for [`isUserInteractionEnabled`][Self::isUserInteractionEnabled].
58        #[unsafe(method(setUserInteractionEnabled:))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);
61
62        /// Defaults to NO. Set if you need to manage the the hit-testing of animating view hierarchies
63        #[unsafe(method(isManualHitTestingEnabled))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn isManualHitTestingEnabled(&self) -> bool;
66
67        /// Setter for [`isManualHitTestingEnabled`][Self::isManualHitTestingEnabled].
68        #[unsafe(method(setManualHitTestingEnabled:))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn setManualHitTestingEnabled(&self, manual_hit_testing_enabled: bool);
71
72        /// Defaults to YES. Raises if set on an active animator.
73        #[unsafe(method(isInterruptible))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn isInterruptible(&self) -> bool;
76
77        /// Setter for [`isInterruptible`][Self::isInterruptible].
78        #[unsafe(method(setInterruptible:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn setInterruptible(&self, interruptible: bool);
81
82        /// Defaults to YES. Provides the ability for an animator to pause and scrub either linearly or using the animator’s current timing.
83        #[unsafe(method(scrubsLinearly))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn scrubsLinearly(&self) -> bool;
86
87        /// Setter for [`scrubsLinearly`][Self::scrubsLinearly].
88        #[unsafe(method(setScrubsLinearly:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setScrubsLinearly(&self, scrubs_linearly: bool);
91
92        /// Defaults to NO. Provides the ability for an animator to pause on completion instead of transitioning to the .inactive state.
93        #[unsafe(method(pausesOnCompletion))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn pausesOnCompletion(&self) -> bool;
96
97        /// Setter for [`pausesOnCompletion`][Self::pausesOnCompletion].
98        #[unsafe(method(setPausesOnCompletion:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn setPausesOnCompletion(&self, pauses_on_completion: bool);
101
102        #[cfg(feature = "UITimingCurveProvider")]
103        #[unsafe(method(initWithDuration:timingParameters:))]
104        #[unsafe(method_family = init)]
105        pub unsafe fn initWithDuration_timingParameters(
106            this: Allocated<Self>,
107            duration: NSTimeInterval,
108            parameters: &ProtocolObject<dyn UITimingCurveProvider>,
109        ) -> Retained<Self>;
110
111        #[cfg(all(feature = "UIView", feature = "block2"))]
112        /// All convenience initializers return an animator which is not running.
113        #[unsafe(method(initWithDuration:curve:animations:))]
114        #[unsafe(method_family = init)]
115        pub unsafe fn initWithDuration_curve_animations(
116            this: Allocated<Self>,
117            duration: NSTimeInterval,
118            curve: UIViewAnimationCurve,
119            animations: Option<&block2::Block<dyn Fn()>>,
120        ) -> Retained<Self>;
121
122        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
123        #[unsafe(method(initWithDuration:controlPoint1:controlPoint2:animations:))]
124        #[unsafe(method_family = init)]
125        pub unsafe fn initWithDuration_controlPoint1_controlPoint2_animations(
126            this: Allocated<Self>,
127            duration: NSTimeInterval,
128            point1: CGPoint,
129            point2: CGPoint,
130            animations: Option<&block2::Block<dyn Fn()>>,
131        ) -> Retained<Self>;
132
133        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
134        #[unsafe(method(initWithDuration:dampingRatio:animations:))]
135        #[unsafe(method_family = init)]
136        pub unsafe fn initWithDuration_dampingRatio_animations(
137            this: Allocated<Self>,
138            duration: NSTimeInterval,
139            ratio: CGFloat,
140            animations: Option<&block2::Block<dyn Fn()>>,
141        ) -> Retained<Self>;
142
143        #[cfg(all(feature = "UIView", feature = "UIViewAnimating", feature = "block2"))]
144        /// This method provides compatibility with the old style [UIView
145        /// animationWithDuration:...]  method. It is also useful for controlling
146        /// how animations options are inherited.
147        ///
148        /// Creates a UIViewPropertyAnimator, sets the duration, options, etc. And starts the
149        /// animation with the associated animation and completion blocks. The animator
150        /// returned is interruptible only if it is not called from within the execution
151        /// block of another animation (animator or legacy). Note that if it is called
152        /// within the execution block of another animation it will inherit the duration
153        /// and other characteristics of that animation UNLESS the appropriate override
154        /// options have been specified. Also note that if is called within the execution
155        /// block of another propertyAnimator that is interruptible, the implicit
156        /// animations defined by this call will be tracked by the outer
157        /// propertyAnimator.
158        #[unsafe(method(runningPropertyAnimatorWithDuration:delay:options:animations:completion:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn runningPropertyAnimatorWithDuration_delay_options_animations_completion(
161            duration: NSTimeInterval,
162            delay: NSTimeInterval,
163            options: UIViewAnimationOptions,
164            animations: &block2::Block<dyn Fn()>,
165            completion: Option<&block2::Block<dyn Fn(UIViewAnimatingPosition)>>,
166            mtm: MainThreadMarker,
167        ) -> Retained<Self>;
168
169        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
170        /// Animatable view properties that are set by the animation block will be
171        /// animated to their new values. The animations will commence at delayFactor *
172        /// animator.duration seconds into the animation. The duration of the animation
173        /// will be (1 - delayFactor) * animator.duration seconds.
174        #[unsafe(method(addAnimations:delayFactor:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn addAnimations_delayFactor(
177            &self,
178            animation: &block2::Block<dyn Fn()>,
179            delay_factor: CGFloat,
180        );
181
182        #[cfg(feature = "block2")]
183        /// Animatable view properties that are set by the animation block will be
184        /// animated to their new values. Starting an animator that does not contain any animation blocks
185        /// will start the animator in a transient paused state. While in this state, submitting an animation
186        /// block will automatically start animating any animatable view properties set therein. When the
187        /// animator is stopped, either naturally completing or explicitly, any animation blocks and completion
188        /// handlers are invalidated. Immediately calling `startAnimation` again on the animator, since there
189        /// are no animation blocks, will start the animator in a transient paused state.
190        #[unsafe(method(addAnimations:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn addAnimations(&self, animation: &block2::Block<dyn Fn()>);
193
194        #[cfg(all(feature = "UIViewAnimating", feature = "block2"))]
195        #[unsafe(method(addCompletion:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn addCompletion(
198            &self,
199            completion: &block2::Block<dyn Fn(UIViewAnimatingPosition)>,
200        );
201
202        #[cfg(all(feature = "UITimingCurveProvider", feature = "objc2-core-foundation"))]
203        /// Provides a means to continue an animation in either the forward or reversed
204        /// directions with new timing parameters and duration.  The durationFactor is in
205        /// terms of a unit duration defined by the originally specified duration of the
206        /// animator. It is used to specify the remaining time for the animation. When
207        /// called, it behaves as if the animation was started from its current position
208        /// with a new duration and timing parameters.
209        #[unsafe(method(continueAnimationWithTimingParameters:durationFactor:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn continueAnimationWithTimingParameters_durationFactor(
212            &self,
213            parameters: Option<&ProtocolObject<dyn UITimingCurveProvider>>,
214            duration_factor: CGFloat,
215        );
216    );
217}
218
219/// Methods declared on superclass `NSObject`.
220impl UIViewPropertyAnimator {
221    extern_methods!(
222        #[unsafe(method(init))]
223        #[unsafe(method_family = init)]
224        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
225
226        #[unsafe(method(new))]
227        #[unsafe(method_family = new)]
228        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
229    );
230}