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