objc2_ui_kit/generated/
UISwipeGestureRecognizer.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/uiswipegesturerecognizerdirection?language=objc)
11// NS_OPTIONS
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct UISwipeGestureRecognizerDirection(pub NSUInteger);
15bitflags::bitflags! {
16    impl UISwipeGestureRecognizerDirection: NSUInteger {
17        #[doc(alias = "UISwipeGestureRecognizerDirectionRight")]
18        const Right = 1<<0;
19        #[doc(alias = "UISwipeGestureRecognizerDirectionLeft")]
20        const Left = 1<<1;
21        #[doc(alias = "UISwipeGestureRecognizerDirectionUp")]
22        const Up = 1<<2;
23        #[doc(alias = "UISwipeGestureRecognizerDirectionDown")]
24        const Down = 1<<3;
25    }
26}
27
28unsafe impl Encode for UISwipeGestureRecognizerDirection {
29    const ENCODING: Encoding = NSUInteger::ENCODING;
30}
31
32unsafe impl RefEncode for UISwipeGestureRecognizerDirection {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern_class!(
37    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiswipegesturerecognizer?language=objc)
38    #[unsafe(super(UIGestureRecognizer, NSObject))]
39    #[thread_kind = MainThreadOnly]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    #[cfg(feature = "UIGestureRecognizer")]
42    pub struct UISwipeGestureRecognizer;
43);
44
45#[cfg(feature = "UIGestureRecognizer")]
46extern_conformance!(
47    unsafe impl NSObjectProtocol for UISwipeGestureRecognizer {}
48);
49
50#[cfg(feature = "UIGestureRecognizer")]
51impl UISwipeGestureRecognizer {
52    extern_methods!(
53        #[unsafe(method(numberOfTouchesRequired))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn numberOfTouchesRequired(&self) -> NSUInteger;
56
57        /// Setter for [`numberOfTouchesRequired`][Self::numberOfTouchesRequired].
58        #[unsafe(method(setNumberOfTouchesRequired:))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn setNumberOfTouchesRequired(&self, number_of_touches_required: NSUInteger);
61
62        #[unsafe(method(direction))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn direction(&self) -> UISwipeGestureRecognizerDirection;
65
66        /// Setter for [`direction`][Self::direction].
67        #[unsafe(method(setDirection:))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn setDirection(&self, direction: UISwipeGestureRecognizerDirection);
70    );
71}
72
73/// Methods declared on superclass `UIGestureRecognizer`.
74#[cfg(feature = "UIGestureRecognizer")]
75impl UISwipeGestureRecognizer {
76    extern_methods!(
77        #[unsafe(method(initWithTarget:action:))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn initWithTarget_action(
80            this: Allocated<Self>,
81            target: Option<&AnyObject>,
82            action: Option<Sel>,
83        ) -> Retained<Self>;
84
85        #[unsafe(method(init))]
86        #[unsafe(method_family = init)]
87        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
88
89        #[unsafe(method(initWithCoder:))]
90        #[unsafe(method_family = init)]
91        pub unsafe fn initWithCoder(
92            this: Allocated<Self>,
93            coder: &NSCoder,
94        ) -> Option<Retained<Self>>;
95    );
96}
97
98/// Methods declared on superclass `NSObject`.
99#[cfg(feature = "UIGestureRecognizer")]
100impl UISwipeGestureRecognizer {
101    extern_methods!(
102        #[unsafe(method(new))]
103        #[unsafe(method_family = new)]
104        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
105    );
106}