objc2_ui_kit/generated/
UIAccelerometer.rs

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