objc2_ui_kit/generated/
UIWritingToolsCoordinatorAnimationParameters.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::*;
8
9use crate::*;
10
11extern_class!(
12    /// An object you use to configure additional tasks or animations to
13    /// run alongside the Writing Tools animations.
14    ///
15    /// When Writing Tools replaces text in one of your context objects,
16    /// it provides a `UIWritingToolsCoordinator.AnimationParameters` object for
17    /// you to use to configure any additional animations. During a Writing
18    /// Tools session, you hide the text under evaluation and provide a
19    /// targeted preview of your content. Writing Tools animations changes
20    /// to that preview, but you might need to provide additional animations
21    /// for other parts of your view’s content. For example, you might
22    /// need to animate any layout changes caused by the insertion or
23    /// removal of text in other parts of your view. Use this object to
24    /// configure those animations.
25    ///
26    /// You don’t create a `UIWritingToolsCoordinator.AnimationParameters`
27    /// object directly. Instead, the system creates one and passes it to the
28    /// ``UIWritingToolsCoordinator/writingToolsCoordinator(_:replaceRange:inContext:proposedText:reason:animationParameters:completion:)``
29    /// method of your ``UIWritingToolsCoordinatorDelegate`` object. Use that
30    /// object to specify the blocks to run during and after the system animations.
31    ///
32    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwritingtoolscoordinatoranimationparameters?language=objc)
33    #[unsafe(super(NSObject))]
34    #[derive(Debug, PartialEq, Eq, Hash)]
35    pub struct UIWritingToolsCoordinatorAnimationParameters;
36);
37
38unsafe impl Send for UIWritingToolsCoordinatorAnimationParameters {}
39
40unsafe impl Sync for UIWritingToolsCoordinatorAnimationParameters {}
41
42extern_conformance!(
43    unsafe impl NSObjectProtocol for UIWritingToolsCoordinatorAnimationParameters {}
44);
45
46impl UIWritingToolsCoordinatorAnimationParameters {
47    extern_methods!(
48        #[unsafe(method(init))]
49        #[unsafe(method_family = init)]
50        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
51
52        #[cfg(feature = "objc2-core-foundation")]
53        /// The number of seconds it takes the system animations to run.
54        ///
55        /// This property is not atomic.
56        ///
57        /// # Safety
58        ///
59        /// This might not be thread-safe.
60        #[unsafe(method(duration))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn duration(&self) -> CGFloat;
63
64        #[cfg(feature = "objc2-core-foundation")]
65        /// The number of seconds the system waits before starting its animations.
66        ///
67        /// This property is not atomic.
68        ///
69        /// # Safety
70        ///
71        /// This might not be thread-safe.
72        #[unsafe(method(delay))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn delay(&self) -> CGFloat;
75
76        #[cfg(feature = "block2")]
77        /// A custom block that runs at the same time as the system animations.
78        ///
79        /// If you have animations you want to run at the same time as the system
80        /// animations, assign a block to this property and use it to run your
81        /// animations. The block you provide must have no return value and take
82        /// a floating-point value as a parameter. The parameter indicates the
83        /// current progress of the animations as a percentage value between
84        /// `0.0` to `1.0`. The system executes your block multiple times during
85        /// the course of the animations, providing an updated completion value each time.
86        ///
87        /// This property is not atomic.
88        ///
89        /// # Safety
90        ///
91        /// This might not be thread-safe.
92        #[unsafe(method(progressHandler))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn progressHandler(&self) -> *mut block2::DynBlock<dyn Fn(c_float)>;
95
96        #[cfg(feature = "block2")]
97        /// Setter for [`progressHandler`][Self::progressHandler].
98        ///
99        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
100        ///
101        /// # Safety
102        ///
103        /// This might not be thread-safe.
104        #[unsafe(method(setProgressHandler:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn setProgressHandler(
107            &self,
108            progress_handler: Option<&block2::DynBlock<dyn Fn(c_float)>>,
109        );
110
111        #[cfg(feature = "block2")]
112        /// A custom block to run when the system animations finish.
113        ///
114        /// Set this property to a block that you want the system to run when any
115        /// animations finish. The block you provide must have no return value
116        /// and no parameters. The system executes this block once when the current
117        /// animation finish.
118        ///
119        /// This property is not atomic.
120        ///
121        /// # Safety
122        ///
123        /// This might not be thread-safe.
124        #[unsafe(method(completionHandler))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn completionHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;
127
128        #[cfg(feature = "block2")]
129        /// Setter for [`completionHandler`][Self::completionHandler].
130        ///
131        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
132        ///
133        /// # Safety
134        ///
135        /// This might not be thread-safe.
136        #[unsafe(method(setCompletionHandler:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setCompletionHandler(
139            &self,
140            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
141        );
142    );
143}
144
145/// Methods declared on superclass `NSObject`.
146impl UIWritingToolsCoordinatorAnimationParameters {
147    extern_methods!(
148        #[unsafe(method(new))]
149        #[unsafe(method_family = new)]
150        pub unsafe fn new() -> Retained<Self>;
151    );
152}