1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;
use crate::*;
extern_class!(
/// Allows to formally participate in UI updates and influence UI update behavior.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiupdatelink?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIUpdateLink;
);
extern_conformance!(
unsafe impl NSObjectProtocol for UIUpdateLink {}
);
impl UIUpdateLink {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(
feature = "UIResponder",
feature = "UIScene",
feature = "UIWindowScene"
))]
#[unsafe(method(updateLinkForWindowScene:))]
#[unsafe(method_family = none)]
pub fn updateLinkForWindowScene(window_scene: &UIWindowScene) -> Retained<UIUpdateLink>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[unsafe(method(updateLinkForView:))]
#[unsafe(method_family = none)]
pub fn updateLinkForView(view: &UIView) -> Retained<UIUpdateLink>;
#[cfg(all(
feature = "UIUpdateActionPhase",
feature = "UIUpdateInfo",
feature = "block2"
))]
#[unsafe(method(addActionToPhase:handler:))]
#[unsafe(method_family = none)]
pub fn addActionToPhase_handler(
&self,
phase: &UIUpdateActionPhase,
handler: &block2::DynBlock<dyn Fn(NonNull<UIUpdateLink>, NonNull<UIUpdateInfo>)>,
);
#[cfg(feature = "UIUpdateActionPhase")]
/// # Safety
///
/// - `target` should be of the correct type.
/// - `selector` must be a valid selector.
#[unsafe(method(addActionToPhase:target:selector:))]
#[unsafe(method_family = none)]
pub unsafe fn addActionToPhase_target_selector(
&self,
phase: &UIUpdateActionPhase,
target: &AnyObject,
selector: Sel,
);
/// It's required to enable the Update Link for it to have effect and for its actions to be invoked.
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub fn isEnabled(&self) -> bool;
/// Setter for [`isEnabled`][Self::isEnabled].
#[unsafe(method(setEnabled:))]
#[unsafe(method_family = none)]
pub fn setEnabled(&self, enabled: bool);
/// By default, `UIUpdateLink` is a passive UI update observer. Its actions will only be called when UI update is being
/// produced. When this property is set to `YES`, `UIUpdateLink` will request continuous UI updates by itself.
#[unsafe(method(requiresContinuousUpdates))]
#[unsafe(method_family = none)]
pub fn requiresContinuousUpdates(&self) -> bool;
/// Setter for [`requiresContinuousUpdates`][Self::requiresContinuousUpdates].
#[unsafe(method(setRequiresContinuousUpdates:))]
#[unsafe(method_family = none)]
pub fn setRequiresContinuousUpdates(&self, requires_continuous_updates: bool);
/// Request dispatch of low-latency eligible events in `LowLatencyEventDispatch` phase. Low latency eligible events are
/// dispatch in the middle of the UI update, meaning that to handle them application has half the time, compared to
/// events dispatched normally. Consult `-[UIUpdateInfo completionDeadlineTime]` for exact completion deadline time.
#[unsafe(method(wantsLowLatencyEventDispatch))]
#[unsafe(method_family = none)]
pub fn wantsLowLatencyEventDispatch(&self) -> bool;
/// Setter for [`wantsLowLatencyEventDispatch`][Self::wantsLowLatencyEventDispatch].
#[unsafe(method(setWantsLowLatencyEventDispatch:))]
#[unsafe(method_family = none)]
pub fn setWantsLowLatencyEventDispatch(&self, wants_low_latency_event_dispatch: bool);
/// Request immediate frame presentation. When enabled, system will request immediate rendering of the display frame
/// after last `CATransaction` commit for the current UI update. This allows to reduce input to display latency, as
/// rendered display frame will be presented one frame duration sooner. However, for this to happen amount of work
/// submitted to render server should be minimal, otherwise it will not be able to submit frame for presentation in
/// time. This capability is primarily useful for pencil drawing applications where low input to display latency is
/// critical for good user experience. Applications that request immediate presentation must be profiled thoroughly to
/// ensure that amount of application and render server work is adequate. When application requests immediate
/// presentation, but fails to keep work complexity at minimum, user will experience on screen judder, as frames will
/// not be presented at their intended time.
#[unsafe(method(wantsImmediatePresentation))]
#[unsafe(method_family = none)]
pub fn wantsImmediatePresentation(&self) -> bool;
/// Setter for [`wantsImmediatePresentation`][Self::wantsImmediatePresentation].
#[unsafe(method(setWantsImmediatePresentation:))]
#[unsafe(method_family = none)]
pub fn setWantsImmediatePresentation(&self, wants_immediate_presentation: bool);
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
/// Preferred frame rate range. Even when not forcing periodic updates, this will still express intention to the system.
/// Use `CAFrameRateRangeDefault` (default value) to not request any specific frame rate range.
#[unsafe(method(preferredFrameRateRange))]
#[unsafe(method_family = none)]
pub fn preferredFrameRateRange(&self) -> CAFrameRateRange;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
/// Setter for [`preferredFrameRateRange`][Self::preferredFrameRateRange].
#[unsafe(method(setPreferredFrameRateRange:))]
#[unsafe(method_family = none)]
pub fn setPreferredFrameRateRange(&self, preferred_frame_rate_range: CAFrameRateRange);
#[cfg(feature = "UIUpdateInfo")]
/// During UI update, returns `UIUpdateInfo` instance describing current UI update state. Returns `nil` outside of UI
/// update.
#[unsafe(method(currentUpdateInfo))]
#[unsafe(method_family = none)]
pub fn currentUpdateInfo(&self) -> Option<Retained<UIUpdateInfo>>;
);
}
/// Convenience.
impl UIUpdateLink {
extern_methods!(
#[cfg(all(feature = "UIUpdateInfo", feature = "block2"))]
/// Adds action to `UIUpdateActionPhase.beforeCADisplayLinkDispatch` phase.
#[unsafe(method(addActionWithHandler:))]
#[unsafe(method_family = none)]
pub fn addActionWithHandler(
&self,
handler: &block2::DynBlock<dyn Fn(NonNull<UIUpdateLink>, NonNull<UIUpdateInfo>)>,
);
/// Adds action to `UIUpdateActionPhase.beforeCADisplayLinkDispatch` phase.
///
/// # Safety
///
/// - `target` should be of the correct type.
/// - `selector` must be a valid selector.
#[unsafe(method(addActionWithTarget:selector:))]
#[unsafe(method_family = none)]
pub unsafe fn addActionWithTarget_selector(&self, target: &AnyObject, selector: Sel);
#[cfg(all(
feature = "UIResponder",
feature = "UIScene",
feature = "UIUpdateInfo",
feature = "UIWindowScene",
feature = "block2"
))]
/// Adds action to `UIUpdateActionPhase.beforeCADisplayLinkDispatch` phase.
#[unsafe(method(updateLinkForWindowScene:actionHandler:))]
#[unsafe(method_family = none)]
pub fn updateLinkForWindowScene_actionHandler(
window_scene: &UIWindowScene,
handler: &block2::DynBlock<dyn Fn(NonNull<UIUpdateLink>, NonNull<UIUpdateInfo>)>,
) -> Retained<UIUpdateLink>;
#[cfg(all(
feature = "UIResponder",
feature = "UIScene",
feature = "UIWindowScene"
))]
/// Adds action to `UIUpdateActionPhase.beforeCADisplayLinkDispatch` phase.
///
/// # Safety
///
/// - `target` should be of the correct type.
/// - `selector` must be a valid selector.
#[unsafe(method(updateLinkForWindowScene:actionTarget:selector:))]
#[unsafe(method_family = none)]
pub unsafe fn updateLinkForWindowScene_actionTarget_selector(
window_scene: &UIWindowScene,
target: &AnyObject,
selector: Sel,
) -> Retained<UIUpdateLink>;
#[cfg(all(
feature = "UIResponder",
feature = "UIUpdateInfo",
feature = "UIView",
feature = "block2"
))]
/// Adds action to `UIUpdateActionPhase.beforeCADisplayLinkDispatch` phase.
#[unsafe(method(updateLinkForView:actionHandler:))]
#[unsafe(method_family = none)]
pub fn updateLinkForView_actionHandler(
view: &UIView,
handler: &block2::DynBlock<dyn Fn(NonNull<UIUpdateLink>, NonNull<UIUpdateInfo>)>,
) -> Retained<UIUpdateLink>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
/// Adds action to `UIUpdateActionPhase.beforeCADisplayLinkDispatch` phase.
///
/// # Safety
///
/// - `target` should be of the correct type.
/// - `selector` must be a valid selector.
#[unsafe(method(updateLinkForView:actionTarget:selector:))]
#[unsafe(method_family = none)]
pub unsafe fn updateLinkForView_actionTarget_selector(
view: &UIView,
target: &AnyObject,
selector: Sel,
) -> Retained<UIUpdateLink>;
);
}