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)
11#[deprecated = "UIAcceleration has been replaced by the CoreMotion framework"]
12pub type UIAccelerationValue = c_double;
13
14extern_class!(
15    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiacceleration?language=objc)
16    #[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
51/// Methods declared on superclass `NSObject`.
52impl 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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccelerometer?language=objc)
66    #[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        /// Setter for [`updateInterval`][Self::updateInterval].
90        #[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        /// Setter for [`delegate`][Self::delegate].
101        ///
102        /// This is a [weak property][objc2::topics::weak_property].
103        #[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
110/// Methods declared on superclass `NSObject`.
111impl 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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccelerometerdelegate?language=objc)
125    #[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);