objc2_ui_kit/generated/
UIAccelerometer.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[deprecated = "UIAcceleration has been replaced by the CoreMotion framework"]
12pub type UIAccelerationValue = c_double;
13
14extern_class!(
15 #[unsafe(super(NSObject))]
17 #[thread_kind = MainThreadOnly]
18 #[derive(Debug, PartialEq, Eq, Hash)]
19 #[deprecated = "UIAcceleration has been replaced by the CoreMotion framework"]
20 pub struct UIAcceleration;
21);
22
23extern_conformance!(
24 unsafe impl NSObjectProtocol for UIAcceleration {}
25);
26
27impl UIAcceleration {
28 extern_methods!(
29 #[deprecated = "UIAcceleration has been replaced by the CoreMotion framework"]
30 #[unsafe(method(timestamp))]
31 #[unsafe(method_family = none)]
32 pub fn timestamp(&self) -> NSTimeInterval;
33
34 #[deprecated = "UIAcceleration has been replaced by the CoreMotion framework"]
35 #[unsafe(method(x))]
36 #[unsafe(method_family = none)]
37 pub fn x(&self) -> UIAccelerationValue;
38
39 #[deprecated = "UIAcceleration has been replaced by the CoreMotion framework"]
40 #[unsafe(method(y))]
41 #[unsafe(method_family = none)]
42 pub fn y(&self) -> UIAccelerationValue;
43
44 #[deprecated = "UIAcceleration has been replaced by the CoreMotion framework"]
45 #[unsafe(method(z))]
46 #[unsafe(method_family = none)]
47 pub fn z(&self) -> UIAccelerationValue;
48 );
49}
50
51impl UIAcceleration {
53 extern_methods!(
54 #[unsafe(method(init))]
55 #[unsafe(method_family = init)]
56 pub fn init(this: Allocated<Self>) -> Retained<Self>;
57
58 #[unsafe(method(new))]
59 #[unsafe(method_family = new)]
60 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
61 );
62}
63
64extern_class!(
65 #[unsafe(super(NSObject))]
67 #[thread_kind = MainThreadOnly]
68 #[derive(Debug, PartialEq, Eq, Hash)]
69 #[deprecated = "UIAccelerometer has been replaced by the CoreMotion framework"]
70 pub struct UIAccelerometer;
71);
72
73extern_conformance!(
74 unsafe impl NSObjectProtocol for UIAccelerometer {}
75);
76
77impl UIAccelerometer {
78 extern_methods!(
79 #[deprecated = "UIAccelerometer has been replaced by the CoreMotion framework"]
80 #[unsafe(method(sharedAccelerometer))]
81 #[unsafe(method_family = none)]
82 pub fn sharedAccelerometer(mtm: MainThreadMarker) -> Retained<UIAccelerometer>;
83
84 #[deprecated = "UIAccelerometer has been replaced by the CoreMotion framework"]
85 #[unsafe(method(updateInterval))]
86 #[unsafe(method_family = none)]
87 pub fn updateInterval(&self) -> NSTimeInterval;
88
89 #[deprecated = "UIAccelerometer has been replaced by the CoreMotion framework"]
91 #[unsafe(method(setUpdateInterval:))]
92 #[unsafe(method_family = none)]
93 pub fn setUpdateInterval(&self, update_interval: NSTimeInterval);
94
95 #[deprecated = "UIAccelerometer has been replaced by the CoreMotion framework"]
96 #[unsafe(method(delegate))]
97 #[unsafe(method_family = none)]
98 pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIAccelerometerDelegate>>>;
99
100 #[deprecated = "UIAccelerometer has been replaced by the CoreMotion framework"]
104 #[unsafe(method(setDelegate:))]
105 #[unsafe(method_family = none)]
106 pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIAccelerometerDelegate>>);
107 );
108}
109
110impl UIAccelerometer {
112 extern_methods!(
113 #[unsafe(method(init))]
114 #[unsafe(method_family = init)]
115 pub fn init(this: Allocated<Self>) -> Retained<Self>;
116
117 #[unsafe(method(new))]
118 #[unsafe(method_family = new)]
119 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
120 );
121}
122
123extern_protocol!(
124 #[deprecated = "UIAcceleration has been replaced by the CoreMotion framework"]
126 pub unsafe trait UIAccelerometerDelegate: NSObjectProtocol + MainThreadOnly {
127 #[deprecated]
128 #[optional]
129 #[unsafe(method(accelerometer:didAccelerate:))]
130 #[unsafe(method_family = none)]
131 fn accelerometer_didAccelerate(
132 &self,
133 accelerometer: &UIAccelerometer,
134 acceleration: &UIAcceleration,
135 );
136 }
137);