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