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