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))]
74unsafe impl CALayerDelegate for ARCoachingOverlayView {}
75
76#[cfg(all(
77    feature = "objc2",
78    feature = "objc2-foundation",
79    feature = "objc2-ui-kit"
80))]
81unsafe impl NSCoding for ARCoachingOverlayView {}
82
83#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
84unsafe impl NSObjectProtocol for ARCoachingOverlayView {}
85
86#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
87unsafe impl UIAppearance for ARCoachingOverlayView {}
88
89#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
90unsafe impl UIAppearanceContainer for ARCoachingOverlayView {}
91
92#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
93unsafe impl UICoordinateSpace for ARCoachingOverlayView {}
94
95#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
96unsafe impl UIDynamicItem for ARCoachingOverlayView {}
97
98#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
99unsafe impl UIFocusEnvironment for ARCoachingOverlayView {}
100
101#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
102unsafe impl UIFocusItem for ARCoachingOverlayView {}
103
104#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
105unsafe impl UIFocusItemContainer for ARCoachingOverlayView {}
106
107#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
108unsafe impl UIResponderStandardEditActions for ARCoachingOverlayView {}
109
110#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
111unsafe impl UITraitEnvironment for ARCoachingOverlayView {}
112
113#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
114impl ARCoachingOverlayView {
115    extern_methods!(
116        /// Specifies the delegate used for callbacks
117        #[unsafe(method(delegate))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn delegate(
120            &self,
121        ) -> Option<Retained<ProtocolObject<dyn ARCoachingOverlayViewDelegate>>>;
122
123        /// This is a [weak property][objc2::topics::weak_property].
124        /// Setter for [`delegate`][Self::delegate].
125        #[unsafe(method(setDelegate:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setDelegate(
128            &self,
129            delegate: Option<&ProtocolObject<dyn ARCoachingOverlayViewDelegate>>,
130        );
131
132        #[cfg(feature = "ARSession")]
133        /// A provider of a session to use
134        ///
135        ///
136        /// This property can be used to set the `session` when loading from a storyboard. Setting this property at runtime will also
137        /// set the `session` property.
138        #[unsafe(method(sessionProvider))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn sessionProvider(&self) -> Option<Retained<NSObject>>;
141
142        #[cfg(feature = "ARSession")]
143        /// This is a [weak property][objc2::topics::weak_property].
144        /// Setter for [`sessionProvider`][Self::sessionProvider].
145        #[unsafe(method(setSessionProvider:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setSessionProvider(&self, session_provider: Option<&NSObject>);
148
149        #[cfg(feature = "ARSession")]
150        /// The session that the view uses to update coaching
151        #[unsafe(method(session))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn session(&self) -> Option<Retained<ARSession>>;
154
155        #[cfg(feature = "ARSession")]
156        /// Setter for [`session`][Self::session].
157        #[unsafe(method(setSession:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setSession(&self, session: Option<&ARSession>);
160
161        /// The coaching type used to resolve what messaging to display to the user while activated
162        /// Defaults to `ARCoachingGoalTracking`
163        #[unsafe(method(goal))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn goal(&self) -> ARCoachingGoal;
166
167        /// Setter for [`goal`][Self::goal].
168        #[unsafe(method(setGoal:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setGoal(&self, goal: ARCoachingGoal);
171
172        /// Whether or not the view should activate/deactivate automatically, depending on the current state of the session
173        /// Defaults to `YES`
174        ///
175        ///
176        /// When set to automatically activate, the view will transition to active when the session loses normal tracking for a set amount
177        /// of time.
178        /// When tracking resumes and other requirements (based on `goal`) are met, the view will deactivate.
179        #[unsafe(method(activatesAutomatically))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn activatesAutomatically(&self) -> bool;
182
183        /// Setter for [`activatesAutomatically`][Self::activatesAutomatically].
184        #[unsafe(method(setActivatesAutomatically:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn setActivatesAutomatically(&self, activates_automatically: bool);
187
188        /// Whether or not the view is currently active.
189        ///
190        ///
191        /// See: -[ARCoachingOverlayView setActive:animated:]
192        #[unsafe(method(isActive))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn isActive(&self) -> bool;
195
196        /// Transition the view to either an activated or deactivated state
197        ///
198        ///
199        /// On activation the view will check the current session, and if relocalization is needed it will present a modified UI with
200        /// relocalization coaching and a reset button.
201        ///
202        /// On deactivation the view will become hidden
203        ///
204        /// Parameter `active`: Whether the view should activate, or deactivate
205        ///
206        /// Parameter `animated`: Whether the view animated to activated/deactivated states, or transitions instantly
207        ///
208        ///
209        /// See: -[ARCoachingOverlayViewDelegate coachingOverlayViewDidTriggerReset:]
210        #[unsafe(method(setActive:animated:))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn setActive_animated(&self, active: bool, animated: bool);
213    );
214}
215
216/// Methods declared on superclass `UIView`.
217#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
218impl ARCoachingOverlayView {
219    extern_methods!(
220        #[cfg(feature = "objc2-core-foundation")]
221        #[unsafe(method(initWithFrame:))]
222        #[unsafe(method_family = init)]
223        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
224
225        #[cfg(feature = "objc2-foundation")]
226        #[unsafe(method(initWithCoder:))]
227        #[unsafe(method_family = init)]
228        pub unsafe fn initWithCoder(
229            this: Allocated<Self>,
230            coder: &NSCoder,
231        ) -> Option<Retained<Self>>;
232    );
233}
234
235/// Methods declared on superclass `NSObject`.
236#[cfg(all(feature = "objc2", feature = "objc2-ui-kit"))]
237impl ARCoachingOverlayView {
238    extern_methods!(
239        #[unsafe(method(init))]
240        #[unsafe(method_family = init)]
241        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
242
243        #[unsafe(method(new))]
244        #[unsafe(method_family = new)]
245        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
246    );
247}
248
249#[cfg(feature = "objc2")]
250extern_protocol!(
251    /// [Apple's documentation](https://developer.apple.com/documentation/arkit/arcoachingoverlayviewdelegate?language=objc)
252    #[cfg(feature = "objc2")]
253    pub unsafe trait ARCoachingOverlayViewDelegate: NSObjectProtocol {
254        #[cfg(feature = "objc2-ui-kit")]
255        /// This is called when the user taps the reset button in the relocalization state
256        ///
257        ///
258        /// By default, when the relocalization reset button is tapped, the overlay will call run on the session using the current
259        /// `configuration`, and the `ARSessionRunOptionResetTracking` and `ARSessionRunOptionRemoveExistingAnchors` options. The delegate may
260        /// implement this method to override this behavior. The delegate is then responsible for resetting the session.
261        ///
262        ///
263        /// Parameter `coachingOverlayView`: The view currently active
264        #[optional]
265        #[unsafe(method(coachingOverlayViewDidRequestSessionReset:))]
266        #[unsafe(method_family = none)]
267        unsafe fn coachingOverlayViewDidRequestSessionReset(
268            &self,
269            coaching_overlay_view: &ARCoachingOverlayView,
270        );
271
272        #[cfg(feature = "objc2-ui-kit")]
273        /// This is called when the view activate, either manually or automatically
274        ///
275        ///
276        /// The Developer may hide their application UI in in this callback, and take other appropriate actions to allow
277        /// `ARCoachingOverlayView` to take over the full screen.
278        ///
279        /// Parameter `coachingOverlayView`: The view that will be activated
280        #[optional]
281        #[unsafe(method(coachingOverlayViewWillActivate:))]
282        #[unsafe(method_family = none)]
283        unsafe fn coachingOverlayViewWillActivate(
284            &self,
285            coaching_overlay_view: &ARCoachingOverlayView,
286        );
287
288        #[cfg(feature = "objc2-ui-kit")]
289        /// This is called when the view has been deactivated, either manually or automatically
290        ///
291        ///
292        /// Parameter `coachingOverlayView`: The view that was deactivated
293        #[optional]
294        #[unsafe(method(coachingOverlayViewDidDeactivate:))]
295        #[unsafe(method_family = none)]
296        unsafe fn coachingOverlayViewDidDeactivate(
297            &self,
298            coaching_overlay_view: &ARCoachingOverlayView,
299        );
300    }
301);