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