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
//! Reads `-[UIView safeAreaInsets]` straight from UIKit via `objc2-ui-kit`'s
//! generated `UIView` bindings. Earlier versions of this crate called into a
//! companion Swift Package for this (`@_cdecl` symbols the consumer's Xcode
//! project had to add via SPM); `objc2-ui-kit` exposes the same UIKit method
//! as a plain Rust binding, so that whole tandem is gone.
//!
//! UIKit is main-thread-only: `-safeAreaInsets` (like nearly everything on
//! `UIView`) is undefined behaviour to call off the main thread. This module
//! does not re-check that itself — its one caller, `plugin::init`, is a Bevy
//! system with a `NonSendMarker` parameter, and Bevy only ever schedules
//! `NonSend` systems on the main thread, so the invariant is already upheld
//! by the time execution reaches here.
use UIView;
/// The four safe-area insets, in points, as returned by
/// `-[UIView safeAreaInsets]`.
pub
/// Reads the safe-area insets of the `UIView` at `ui_view`.
///
/// # Safety
///
/// `ui_view` must point at a live, valid `UIView` — as handed back by
/// winit's `RawWindowHandle::UiKit(handle).ui_view` — and the calling thread
/// must be the main thread (see the module docs above).
pub unsafe