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        /// Setter for [`delegate`][Self::delegate].
148        ///
149        /// This is a [weak property][objc2::topics::weak_property].
150        #[unsafe(method(setDelegate:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setDelegate(
153            &self,
154            delegate: Option<&ProtocolObject<dyn ARCoachingOverlayViewDelegate>>,
155        );
156
157        #[cfg(feature = "ARSession")]
158        /// A provider of a session to use
159        ///
160        ///
161        /// This property can be used to set the `session` when loading from a storyboard. Setting this property at runtime will also
162        /// set the `session` property.
163        #[unsafe(method(sessionProvider))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn sessionProvider(&self) -> Option<Retained<NSObject>>;
166
167        #[cfg(feature = "ARSession")]
168        /// Setter for [`sessionProvider`][Self::sessionProvider].
169        ///
170        /// This is a [weak property][objc2::topics::weak_property].
171        ///
172        /// # Safety
173        ///
174        /// `session_provider` must implement ARSessionProviding.
175        #[unsafe(method(setSessionProvider:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn setSessionProvider(&self, session_provider: Option<&NSObject>);
178
179        #[cfg(feature = "ARSession")]
180        /// The session that the view uses to update coaching
181        #[unsafe(method(session))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn session(&self) -> Option<Retained<ARSession>>;
184
185        #[cfg(feature = "ARSession")]
186        /// Setter for [`session`][Self::session].
187        #[unsafe(method(setSession:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn setSession(&self, session: Option<&ARSession>);
190
191        /// The coaching type used to resolve what messaging to display to the user while activated
192        /// Defaults to `ARCoachingGoalTracking`
193        #[unsafe(method(goal))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn goal(&self) -> ARCoachingGoal;
196
197        /// Setter for [`goal`][Self::goal].
198        #[unsafe(method(setGoal:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn setGoal(&self, goal: ARCoachingGoal);
201
202        /// Whether or not the view should activate/deactivate automatically, depending on the current state of the session
203        /// Defaults to `YES`
204        ///
205        ///
206        /// When set to automatically activate, the view will transition to active when the session loses normal tracking for a set amount
207        /// of time.
208        /// When tracking resumes and other requirements (based on `goal`) are met, the view will deactivate.
209        #[unsafe(method(activatesAutomatically))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn activatesAutomatically(&self) -> bool;
212
213        /// Setter for [`activatesAutomatically`][Self::activatesAutomatically].
214        #[unsafe(method(setActivatesAutomatically:))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn setActivatesAutomatically(&self, activates_automatically: bool);
217
218        /// Whether or not the view is currently active.
219        ///
220        ///
221        /// See: -[ARCoachingOverlayView setActive:animated:]
222        #[unsafe(method(isActive))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn isActive(&self) -> bool;
225
226        /// Transition the view to either an activated or deactivated state
227        ///
228        ///
229        /// On activation the view will check the current session, and if relocalization is needed it will present a modified UI with
230        /// relocalization coaching and a reset button.
231        ///
232        /// On deactivation the view will become hidden
233        ///
234        /// Parameter `active`: Whether the view should activate, or deactivate
235        ///
236        /// Parameter `animated`: Whether the view animated to activated/deactivated states, or transitions instantly
237        ///
238        ///
239        /// See: -[ARCoachingOverlayViewDelegate coachingOverlayViewDidTriggerReset:]
240        #[unsafe(method(setActive:animated:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn setActive_animated(&self, active: bool, animated: bool);
243    );
244}
245
246/// Methods declared on superclass `UIView`.
247#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
248impl ARCoachingOverlayView {
249    extern_methods!(
250        #[cfg(feature = "objc2-core-foundation")]
251        #[unsafe(method(initWithFrame:))]
252        #[unsafe(method_family = init)]
253        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
254
255        #[cfg(feature = "objc2-foundation")]
256        /// # Safety
257        ///
258        /// `coder` possibly has further requirements.
259        #[unsafe(method(initWithCoder:))]
260        #[unsafe(method_family = init)]
261        pub unsafe fn initWithCoder(
262            this: Allocated<Self>,
263            coder: &NSCoder,
264        ) -> Option<Retained<Self>>;
265
266        #[unsafe(method(init))]
267        #[unsafe(method_family = init)]
268        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
269    );
270}
271
272/// Methods declared on superclass `NSObject`.
273#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
274impl ARCoachingOverlayView {
275    extern_methods!(
276        #[unsafe(method(new))]
277        #[unsafe(method_family = new)]
278        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
279    );
280}
281
282#[cfg(feature = "objc2")]
283extern_protocol!(
284    /// [Apple's documentation](https://developer.apple.com/documentation/arkit/arcoachingoverlayviewdelegate?language=objc)
285    #[cfg(feature = "objc2")]
286    pub unsafe trait ARCoachingOverlayViewDelegate: NSObjectProtocol {
287        #[cfg(feature = "objc2-ui-kit")]
288        /// This is called when the user taps the reset button in the relocalization state
289        ///
290        ///
291        /// By default, when the relocalization reset button is tapped, the overlay will call run on the session using the current
292        /// `configuration`, and the `ARSessionRunOptionResetTracking` and `ARSessionRunOptionRemoveExistingAnchors` options. The delegate may
293        /// implement this method to override this behavior. The delegate is then responsible for resetting the session.
294        ///
295        ///
296        /// Parameter `coachingOverlayView`: The view currently active
297        #[optional]
298        #[unsafe(method(coachingOverlayViewDidRequestSessionReset:))]
299        #[unsafe(method_family = none)]
300        unsafe fn coachingOverlayViewDidRequestSessionReset(
301            &self,
302            coaching_overlay_view: &ARCoachingOverlayView,
303        );
304
305        #[cfg(feature = "objc2-ui-kit")]
306        /// This is called when the view activate, either manually or automatically
307        ///
308        ///
309        /// The Developer may hide their application UI in in this callback, and take other appropriate actions to allow
310        /// `ARCoachingOverlayView` to take over the full screen.
311        ///
312        /// Parameter `coachingOverlayView`: The view that will be activated
313        #[optional]
314        #[unsafe(method(coachingOverlayViewWillActivate:))]
315        #[unsafe(method_family = none)]
316        unsafe fn coachingOverlayViewWillActivate(
317            &self,
318            coaching_overlay_view: &ARCoachingOverlayView,
319        );
320
321        #[cfg(feature = "objc2-ui-kit")]
322        /// This is called when the view has been deactivated, either manually or automatically
323        ///
324        ///
325        /// Parameter `coachingOverlayView`: The view that was deactivated
326        #[optional]
327        #[unsafe(method(coachingOverlayViewDidDeactivate:))]
328        #[unsafe(method_family = none)]
329        unsafe fn coachingOverlayViewDidDeactivate(
330            &self,
331            coaching_overlay_view: &ARCoachingOverlayView,
332        );
333    }
334);