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 #[unsafe(method(duration))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn duration(&self) -> CGFloat;
57
58 #[cfg(feature = "objc2-core-foundation")]
59 /// The number of seconds the system waits before starting its animations.
60 #[unsafe(method(delay))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn delay(&self) -> CGFloat;
63
64 #[cfg(feature = "block2")]
65 /// A custom block that runs at the same time as the system animations.
66 ///
67 /// If you have animations you want to run at the same time as the system
68 /// animations, assign a block to this property and use it to run your
69 /// animations. The block you provide must have no return value and take
70 /// a floating-point value as a parameter. The parameter indicates the
71 /// current progress of the animations as a percentage value between
72 /// `0.0` to `1.0`. The system executes your block multiple times during
73 /// the course of the animations, providing an updated completion value each time.
74 #[unsafe(method(progressHandler))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn progressHandler(&self) -> *mut block2::DynBlock<dyn Fn(c_float)>;
77
78 #[cfg(feature = "block2")]
79 /// Setter for [`progressHandler`][Self::progressHandler].
80 #[unsafe(method(setProgressHandler:))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn setProgressHandler(
83 &self,
84 progress_handler: Option<&block2::DynBlock<dyn Fn(c_float)>>,
85 );
86
87 #[cfg(feature = "block2")]
88 /// A custom block to run when the system animations finish.
89 ///
90 /// Set this property to a block that you want the system to run when any
91 /// animations finish. The block you provide must have no return value
92 /// and no parameters. The system executes this block once when the current
93 /// animation finish.
94 #[unsafe(method(completionHandler))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn completionHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;
97
98 #[cfg(feature = "block2")]
99 /// Setter for [`completionHandler`][Self::completionHandler].
100 #[unsafe(method(setCompletionHandler:))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn setCompletionHandler(
103 &self,
104 completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
105 );
106 );
107}
108
109/// Methods declared on superclass `NSObject`.
110impl UIWritingToolsCoordinatorAnimationParameters {
111 extern_methods!(
112 #[unsafe(method(new))]
113 #[unsafe(method_family = new)]
114 pub unsafe fn new() -> Retained<Self>;
115 );
116}