objc2_ui_kit/generated/UIUpdateInfo.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10 /// Contains detailed information about the current state of the UI update. This information may change as UI update
11 /// progresses through its phases. Note, that single UI update might service views on different displays simultaneously,
12 /// in which case such views may have different `UIUpdateInfo` (e.g. `estimatedPresentationTime` may differ).
13 ///
14 /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiupdateinfo?language=objc)
15 #[unsafe(super(NSObject))]
16 #[thread_kind = MainThreadOnly]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct UIUpdateInfo;
19);
20
21extern_conformance!(
22 unsafe impl NSObjectProtocol for UIUpdateInfo {}
23);
24
25impl UIUpdateInfo {
26 extern_methods!(
27 #[unsafe(method(new))]
28 #[unsafe(method_family = new)]
29 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
30
31 #[unsafe(method(init))]
32 #[unsafe(method_family = init)]
33 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
34
35 #[cfg(all(
36 feature = "UIResponder",
37 feature = "UIScene",
38 feature = "UIWindowScene"
39 ))]
40 #[unsafe(method(currentUpdateInfoForWindowScene:))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn currentUpdateInfoForWindowScene(
43 window_scene: &UIWindowScene,
44 ) -> Option<Retained<Self>>;
45
46 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
47 #[unsafe(method(currentUpdateInfoForView:))]
48 #[unsafe(method_family = none)]
49 pub unsafe fn currentUpdateInfoForView(view: &UIView) -> Option<Retained<Self>>;
50
51 /// Reference time that is suitable for driving time based model changes, like animations or physics. Use it as "now"
52 /// time for the UI update. It's designed to maintain constant latency between model changes and their on screen
53 /// presentation. Uses same units as `CACurrentMediaTime()`. Numerically, this time is close to the start of the UI
54 /// update, but its exact relation to UI update start time may change depending on frame rate and other UI update
55 /// parameters.
56 #[unsafe(method(modelTime))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn modelTime(&self) -> NSTimeInterval;
59
60 /// Time by which application has to be done submitting changes to the render server. Missing this completion deadline
61 /// will result in a presentation delay. Single miss will look like a frame drop, missing repeatedly will look like
62 /// judder.
63 #[unsafe(method(completionDeadlineTime))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn completionDeadlineTime(&self) -> NSTimeInterval;
66
67 /// Estimated time when UI update changes will become visible on screen. Actual time when pixels change color may
68 /// differ.
69 #[unsafe(method(estimatedPresentationTime))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn estimatedPresentationTime(&self) -> NSTimeInterval;
72
73 /// `YES` for UI updates that are expected to present immediately upon completion. Use it to minimize amount of work
74 /// performed during the UI update. Any processing that is not critical for the frame being presented should be deferred
75 /// to after UI update is complete. Note, that immediate presentation still might not happen if strict conditions
76 /// imposed by the system, like committing `CATransaction` before the `completionDeadlineTime`, are not satisfied.
77 /// Similarly, immediate presentation can be denied at various points of the pipeline, if system detects that current
78 /// CPU or GPU load, power state or frame complexity make reliable immediate presentation impossible or unlikely.
79 /// Immediate presentation is an extremely challenging mode for the entire system and causes excessive power drain and
80 /// has high chances of missing intended presentation time, which results in visual judder. Application that use it
81 /// has high chances of missing intended presentation time, which results in visual judder. Applications that use it
82 /// should be explicitly designed and tuned to operate in this mode - amount of work in each phase should be precisely
83 /// controlled. It is primarily reserved for pencil drawing and writing applications where extra low latency makes a
84 /// noticeable improvement to user experience. Returned value can change during the UI update.
85 #[unsafe(method(isImmediatePresentationExpected))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn isImmediatePresentationExpected(&self) -> bool;
88
89 /// `YES` when it's guaranteed that low-latency event dispatch will happen during the UI update. When `YES` is returned,
90 /// you can rely on low-latency UI update phases to run for this UI update. Use it to avoid doing the same work more
91 /// than once. For example, when rendering a pencil drawing stroke in after event dispatch and
92 /// `lowLatencyEventDispatchConfirmed` is `YES`, while `performingLowLatencyPhases` is `NO`, then it would be better
93 /// to wait for after low-latency event dispatch to render the stroke. Can change from `NO` to `YES` during the UI
94 /// update, but will never change from `YES` to `NO`. When `YES` is returned, low-latency phases always will be
95 /// performed. Note, that checking value of this property might cause system to commit to low-latency event dispatch
96 /// unnecessarily as a side effect - call it only when there's an intention to act on returned value.
97 #[unsafe(method(isLowLatencyEventDispatchConfirmed))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn isLowLatencyEventDispatchConfirmed(&self) -> bool;
100
101 /// `YES` when executing low-latency part of the UI update (specifically between `LowLatencyEventDispatch` and
102 /// `LowLatencyCATransactionCommit` UI update phases). Work in this part of the UI update should be as minimal as
103 /// possible, especially when immediate presentation is to be attempted. Anything that is not critical to the current
104 /// UI update must be deferred after `LowLatencyCATransactionCommit`. Try to avoid using `dispatch_after()` types of
105 /// deferral as arbitrary delayed work will potentially interfere with following UI updates.
106 #[unsafe(method(isPerformingLowLatencyPhases))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn isPerformingLowLatencyPhases(&self) -> bool;
109 );
110}