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")]
46unsafe impl NSObjectProtocol for UISwipeGestureRecognizer {}
47
48#[cfg(feature = "UIGestureRecognizer")]
49impl UISwipeGestureRecognizer {
50    extern_methods!(
51        #[unsafe(method(numberOfTouchesRequired))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn numberOfTouchesRequired(&self) -> NSUInteger;
54
55        /// Setter for [`numberOfTouchesRequired`][Self::numberOfTouchesRequired].
56        #[unsafe(method(setNumberOfTouchesRequired:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn setNumberOfTouchesRequired(&self, number_of_touches_required: NSUInteger);
59
60        #[unsafe(method(direction))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn direction(&self) -> UISwipeGestureRecognizerDirection;
63
64        /// Setter for [`direction`][Self::direction].
65        #[unsafe(method(setDirection:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn setDirection(&self, direction: UISwipeGestureRecognizerDirection);
68    );
69}
70
71/// Methods declared on superclass `UIGestureRecognizer`.
72#[cfg(feature = "UIGestureRecognizer")]
73impl UISwipeGestureRecognizer {
74    extern_methods!(
75        #[unsafe(method(initWithTarget:action:))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn initWithTarget_action(
78            this: Allocated<Self>,
79            target: Option<&AnyObject>,
80            action: Option<Sel>,
81        ) -> Retained<Self>;
82
83        #[unsafe(method(init))]
84        #[unsafe(method_family = init)]
85        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
86
87        #[unsafe(method(initWithCoder:))]
88        #[unsafe(method_family = init)]
89        pub unsafe fn initWithCoder(
90            this: Allocated<Self>,
91            coder: &NSCoder,
92        ) -> Option<Retained<Self>>;
93    );
94}
95
96/// Methods declared on superclass `NSObject`.
97#[cfg(feature = "UIGestureRecognizer")]
98impl UISwipeGestureRecognizer {
99    extern_methods!(
100        #[unsafe(method(new))]
101        #[unsafe(method_family = new)]
102        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
103    );
104}