objc2_ui_kit/generated/
UIPreviewInteraction.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipreviewinteraction?language=objc)
13    #[unsafe(super(NSObject))]
14    #[thread_kind = MainThreadOnly]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct UIPreviewInteraction;
17);
18
19extern_conformance!(
20    unsafe impl NSObjectProtocol for UIPreviewInteraction {}
21);
22
23impl UIPreviewInteraction {
24    extern_methods!(
25        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
26        #[unsafe(method(initWithView:))]
27        #[unsafe(method_family = init)]
28        pub unsafe fn initWithView(this: Allocated<Self>, view: &UIView) -> Retained<Self>;
29
30        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
31        #[unsafe(method(view))]
32        #[unsafe(method_family = none)]
33        pub unsafe fn view(&self) -> Option<Retained<UIView>>;
34
35        #[unsafe(method(init))]
36        #[unsafe(method_family = init)]
37        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
38
39        #[unsafe(method(delegate))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn delegate(
42            &self,
43        ) -> Option<Retained<ProtocolObject<dyn UIPreviewInteractionDelegate>>>;
44
45        /// This is a [weak property][objc2::topics::weak_property].
46        /// Setter for [`delegate`][Self::delegate].
47        #[unsafe(method(setDelegate:))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn setDelegate(
50            &self,
51            delegate: Option<&ProtocolObject<dyn UIPreviewInteractionDelegate>>,
52        );
53
54        #[cfg(all(feature = "UIView", feature = "objc2-core-foundation"))]
55        #[unsafe(method(locationInCoordinateSpace:))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn locationInCoordinateSpace(
58            &self,
59            coordinate_space: Option<&ProtocolObject<dyn UICoordinateSpace>>,
60        ) -> CGPoint;
61
62        #[unsafe(method(cancelInteraction))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn cancelInteraction(&self);
65    );
66}
67
68/// Methods declared on superclass `NSObject`.
69impl UIPreviewInteraction {
70    extern_methods!(
71        #[unsafe(method(new))]
72        #[unsafe(method_family = new)]
73        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
74    );
75}
76
77extern_protocol!(
78    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipreviewinteractiondelegate?language=objc)
79    pub unsafe trait UIPreviewInteractionDelegate:
80        NSObjectProtocol + MainThreadOnly
81    {
82        #[cfg(feature = "objc2-core-foundation")]
83        #[unsafe(method(previewInteraction:didUpdatePreviewTransition:ended:))]
84        #[unsafe(method_family = none)]
85        unsafe fn previewInteraction_didUpdatePreviewTransition_ended(
86            &self,
87            preview_interaction: &UIPreviewInteraction,
88            transition_progress: CGFloat,
89            ended: bool,
90        );
91
92        #[unsafe(method(previewInteractionDidCancel:))]
93        #[unsafe(method_family = none)]
94        unsafe fn previewInteractionDidCancel(&self, preview_interaction: &UIPreviewInteraction);
95
96        #[optional]
97        #[unsafe(method(previewInteractionShouldBegin:))]
98        #[unsafe(method_family = none)]
99        unsafe fn previewInteractionShouldBegin(
100            &self,
101            preview_interaction: &UIPreviewInteraction,
102        ) -> bool;
103
104        #[cfg(feature = "objc2-core-foundation")]
105        #[optional]
106        #[unsafe(method(previewInteraction:didUpdateCommitTransition:ended:))]
107        #[unsafe(method_family = none)]
108        unsafe fn previewInteraction_didUpdateCommitTransition_ended(
109            &self,
110            preview_interaction: &UIPreviewInteraction,
111            transition_progress: CGFloat,
112            ended: bool,
113        );
114    }
115);