objc2_ar_kit/generated/
ARCoachingOverlayView.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7#[cfg(feature = "objc2-core-foundation")]
8use objc2_core_foundation::*;
9#[cfg(feature = "objc2-foundation")]
10use objc2_foundation::*;
11#[cfg(feature = "objc2-quartz-core")]
12use objc2_quartz_core::*;
13#[cfg(feature = "objc2-ui-kit")]
14use objc2_ui_kit::*;
15
16use crate::*;
17
18/// A value describing the context required for successful coaching
19///
20/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arcoachinggoal?language=objc)
21// NS_ENUM
22#[cfg(feature = "objc2")]
23#[repr(transparent)]
24#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
25pub struct ARCoachingGoal(pub NSInteger);
26#[cfg(feature = "objc2")]
27impl ARCoachingGoal {
28    /// Session requires normal tracking
29    #[doc(alias = "ARCoachingGoalTracking")]
30    pub const Tracking: Self = Self(0);
31    /// Session requires a horizontal plane
32    #[doc(alias = "ARCoachingGoalHorizontalPlane")]
33    pub const HorizontalPlane: Self = Self(1);
34    /// Session requires a vertical plane
35    #[doc(alias = "ARCoachingGoalVerticalPlane")]
36    pub const VerticalPlane: Self = Self(2);
37    /// Session requires one plane of any type
38    #[doc(alias = "ARCoachingGoalAnyPlane")]
39    pub const AnyPlane: Self = Self(3);
40    /// Session requires geo tracking
41    #[doc(alias = "ARCoachingGoalGeoTracking")]
42    pub const GeoTracking: Self = Self(4);
43}
44
45#[cfg(feature = "objc2")]
46unsafe impl Encode for ARCoachingGoal {
47    const ENCODING: Encoding = NSInteger::ENCODING;
48}
49
50#[cfg(feature = "objc2")]
51unsafe impl RefEncode for ARCoachingGoal {
52    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
53}
54
55#[cfg(feature = "objc2")]
56extern_class!(
57    /// A view that guides users through session initialization
58    ///
59    ///
60    /// The view will use context aware messaging and animations to instruct the user on gathering required info for the AR session.
61    ///
62    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arcoachingoverlayview?language=objc)
63    #[unsafe(super(UIView, UIResponder, NSObject))]
64    #[derive(Debug, PartialEq, Eq, Hash)]
65    #[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
66    pub struct ARCoachingOverlayView;
67);
68
69#[cfg(all(
70    feature = "objc2",
71    feature = "objc2-quartz-core",
72    feature = "objc2-ui-kit"
73))]
74extern_conformance!(
75    unsafe impl CALayerDelegate for ARCoachingOverlayView {}
76);
77
78#[cfg(all(
79    feature = "objc2",
80    feature = "objc2-foundation",
81    feature = "objc2-ui-kit"
82))]
83extern_conformance!(
84    unsafe impl NSCoding for ARCoachingOverlayView {}
85);
86
87#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
88extern_conformance!(
89    unsafe impl NSObjectProtocol for ARCoachingOverlayView {}
90);
91
92#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
93extern_conformance!(
94    unsafe impl UIAppearance for ARCoachingOverlayView {}
95);
96
97#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
98extern_conformance!(
99    unsafe impl UIAppearanceContainer for ARCoachingOverlayView {}
100);
101
102#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
103extern_conformance!(
104    unsafe impl UICoordinateSpace for ARCoachingOverlayView {}
105);
106
107#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
108extern_conformance!(
109    unsafe impl UIDynamicItem for ARCoachingOverlayView {}
110);
111
112#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
113extern_conformance!(
114    unsafe impl UIFocusEnvironment for ARCoachingOverlayView {}
115);
116
117#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
118extern_conformance!(
119    unsafe impl UIFocusItem for ARCoachingOverlayView {}
120);
121
122#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
123extern_conformance!(
124    unsafe impl UIFocusItemContainer for ARCoachingOverlayView {}
125);
126
127#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
128extern_conformance!(
129    unsafe impl UIResponderStandardEditActions for ARCoachingOverlayView {}
130);
131
132#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
133extern_conformance!(
134    unsafe impl UITraitEnvironment for ARCoachingOverlayView {}
135);
136
137#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
138impl ARCoachingOverlayView {
139    extern_methods!(
140        /// Specifies the delegate used for callbacks
141        #[unsafe(method(delegate))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn delegate(
144            &self,
145        ) -> Option<Retained<ProtocolObject<dyn ARCoachingOverlayViewDelegate>>>;
146
147        /// This is a [weak property][objc2::topics::weak_property].
148        /// Setter for [`delegate`][Self::delegate].
149        #[unsafe(method(setDelegate:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setDelegate(
152            &self,
153            delegate: Option<&ProtocolObject<dyn ARCoachingOverlayViewDelegate>>,
154        );
155
156        #[cfg(feature = "ARSession")]
157        /// A provider of a session to use
158        ///
159        ///
160        /// This property can be used to set the `session` when loading from a storyboard. Setting this property at runtime will also
161        /// set the `session` property.
162        #[unsafe(method(sessionProvider))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn sessionProvider(&self) -> Option<Retained<NSObject>>;
165
166        #[cfg(feature = "ARSession")]
167        /// This is a [weak property][objc2::topics::weak_property].
168        /// Setter for [`sessionProvider`][Self::sessionProvider].
169        #[unsafe(method(setSessionProvider:))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn setSessionProvider(&self, session_provider: Option<&NSObject>);
172
173        #[cfg(feature = "ARSession")]
174        /// The session that the view uses to update coaching
175        #[unsafe(method(session))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn session(&self) -> Option<Retained<ARSession>>;
178
179        #[cfg(feature = "ARSession")]
180        /// Setter for [`session`][Self::session].
181        #[unsafe(method(setSession:))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn setSession(&self, session: Option<&ARSession>);
184
185        /// The coaching type used to resolve what messaging to display to the user while activated
186        /// Defaults to `ARCoachingGoalTracking`
187        #[unsafe(method(goal))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn goal(&self) -> ARCoachingGoal;
190
191        /// Setter for [`goal`][Self::goal].
192        #[unsafe(method(setGoal:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn setGoal(&self, goal: ARCoachingGoal);
195
196        /// Whether or not the view should activate/deactivate automatically, depending on the current state of the session
197        /// Defaults to `YES`
198        ///
199        ///
200        /// When set to automatically activate, the view will transition to active when the session loses normal tracking for a set amount
201        /// of time.
202        /// When tracking resumes and other requirements (based on `goal`) are met, the view will deactivate.
203        #[unsafe(method(activatesAutomatically))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn activatesAutomatically(&self) -> bool;
206
207        /// Setter for [`activatesAutomatically`][Self::activatesAutomatically].
208        #[unsafe(method(setActivatesAutomatically:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn setActivatesAutomatically(&self, activates_automatically: bool);
211
212        /// Whether or not the view is currently active.
213        ///
214        ///
215        /// See: -[ARCoachingOverlayView setActive:animated:]
216        #[unsafe(method(isActive))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn isActive(&self) -> bool;
219
220        /// Transition the view to either an activated or deactivated state
221        ///
222        ///
223        /// On activation the view will check the current session, and if relocalization is needed it will present a modified UI with
224        /// relocalization coaching and a reset button.
225        ///
226        /// On deactivation the view will become hidden
227        ///
228        /// Parameter `active`: Whether the view should activate, or deactivate
229        ///
230        /// Parameter `animated`: Whether the view animated to activated/deactivated states, or transitions instantly
231        ///
232        ///
233        /// See: -[ARCoachingOverlayViewDelegate coachingOverlayViewDidTriggerReset:]
234        #[unsafe(method(setActive:animated:))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn setActive_animated(&self, active: bool, animated: bool);
237    );
238}
239
240/// Methods declared on superclass `UIView`.
241#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
242impl ARCoachingOverlayView {
243    extern_methods!(
244        #[cfg(feature = "objc2-core-foundation")]
245        #[unsafe(method(initWithFrame:))]
246        #[unsafe(method_family = init)]
247        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
248
249        #[cfg(feature = "objc2-foundation")]
250        #[unsafe(method(initWithCoder:))]
251        #[unsafe(method_family = init)]
252        pub unsafe fn initWithCoder(
253            this: Allocated<Self>,
254            coder: &NSCoder,
255        ) -> Option<Retained<Self>>;
256    );
257}
258
259/// Methods declared on superclass `NSObject`.
260#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
261impl ARCoachingOverlayView {
262    extern_methods!(
263        #[unsafe(method(init))]
264        #[unsafe(method_family = init)]
265        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
266
267        #[unsafe(method(new))]
268        #[unsafe(method_family = new)]
269        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
270    );
271}
272
273#[cfg(feature = "objc2")]
274extern_protocol!(
275    /// [Apple's documentation](https://developer.apple.com/documentation/arkit/arcoachingoverlayviewdelegate?language=objc)
276    #[cfg(feature = "objc2")]
277    pub unsafe trait ARCoachingOverlayViewDelegate: NSObjectProtocol {
278        #[cfg(feature = "objc2-ui-kit")]
279        /// This is called when the user taps the reset button in the relocalization state
280        ///
281        ///
282        /// By default, when the relocalization reset button is tapped, the overlay will call run on the session using the current
283        /// `configuration`, and the `ARSessionRunOptionResetTracking` and `ARSessionRunOptionRemoveExistingAnchors` options. The delegate may
284        /// implement this method to override this behavior. The delegate is then responsible for resetting the session.
285        ///
286        ///
287        /// Parameter `coachingOverlayView`: The view currently active
288        #[optional]
289        #[unsafe(method(coachingOverlayViewDidRequestSessionReset:))]
290        #[unsafe(method_family = none)]
291        unsafe fn coachingOverlayViewDidRequestSessionReset(
292            &self,
293            coaching_overlay_view: &ARCoachingOverlayView,
294        );
295
296        #[cfg(feature = "objc2-ui-kit")]
297        /// This is called when the view activate, either manually or automatically
298        ///
299        ///
300        /// The Developer may hide their application UI in in this callback, and take other appropriate actions to allow
301        /// `ARCoachingOverlayView` to take over the full screen.
302        ///
303        /// Parameter `coachingOverlayView`: The view that will be activated
304        #[optional]
305        #[unsafe(method(coachingOverlayViewWillActivate:))]
306        #[unsafe(method_family = none)]
307        unsafe fn coachingOverlayViewWillActivate(
308            &self,
309            coaching_overlay_view: &ARCoachingOverlayView,
310        );
311
312        #[cfg(feature = "objc2-ui-kit")]
313        /// This is called when the view has been deactivated, either manually or automatically
314        ///
315        ///
316        /// Parameter `coachingOverlayView`: The view that was deactivated
317        #[optional]
318        #[unsafe(method(coachingOverlayViewDidDeactivate:))]
319        #[unsafe(method_family = none)]
320        unsafe fn coachingOverlayViewDidDeactivate(
321            &self,
322            coaching_overlay_view: &ARCoachingOverlayView,
323        );
324    }
325);