objc2_ui_kit/
geometry.rs

1//! Inlined from UIUtilities' UIGeometry.h, was moved from UIKit to there in
2//! Xcode 26 (but it is unclear whether UIUtilities is intended to be
3//! publicly exposed).
4//!
5//! Find it with:
6//! ```sh
7//! ls $(xcrun --sdk iphoneos --show-sdk-path)/System/Library/SubFrameworks/UIUtilities.framework/Headers/UIGeometry.h
8//! ```
9use objc2::encode::{Encode, Encoding, RefEncode};
10use objc2_foundation::NSUInteger;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uirectedge?language=objc)
13// NS_OPTIONS
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIRectEdge(pub NSUInteger);
17bitflags::bitflags! {
18    impl UIRectEdge: NSUInteger {
19        #[doc(alias = "UIRectEdgeNone")]
20        const None = 0;
21        #[doc(alias = "UIRectEdgeTop")]
22        const Top = 1<<0;
23        #[doc(alias = "UIRectEdgeLeft")]
24        const Left = 1<<1;
25        #[doc(alias = "UIRectEdgeBottom")]
26        const Bottom = 1<<2;
27        #[doc(alias = "UIRectEdgeRight")]
28        const Right = 1<<3;
29        #[doc(alias = "UIRectEdgeAll")]
30        const All = UIRectEdge::Top.0|UIRectEdge::Left.0|UIRectEdge::Bottom.0|UIRectEdge::Right.0;
31    }
32}
33
34unsafe impl Encode for UIRectEdge {
35    const ENCODING: Encoding = NSUInteger::ENCODING;
36}
37
38unsafe impl RefEncode for UIRectEdge {
39    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
40}
41
42/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaxis?language=objc)
43// NS_OPTIONS
44#[repr(transparent)]
45#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
46pub struct UIAxis(pub NSUInteger);
47bitflags::bitflags! {
48    impl UIAxis: NSUInteger {
49        #[doc(alias = "UIAxisNeither")]
50        const Neither = 0;
51        #[doc(alias = "UIAxisHorizontal")]
52        const Horizontal = 1<<0;
53        #[doc(alias = "UIAxisVertical")]
54        const Vertical = 1<<1;
55        #[doc(alias = "UIAxisBoth")]
56        const Both = UIAxis::Horizontal.0|UIAxis::Vertical.0;
57    }
58}
59
60unsafe impl Encode for UIAxis {
61    const ENCODING: Encoding = NSUInteger::ENCODING;
62}
63
64unsafe impl RefEncode for UIAxis {
65    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
66}