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