1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UISpringLoadedInteractionEffectState(pub NSInteger);
impl UISpringLoadedInteractionEffectState {
    #[doc(alias = "UISpringLoadedInteractionEffectStateInactive")]
    pub const Inactive: Self = Self(0);
    #[doc(alias = "UISpringLoadedInteractionEffectStatePossible")]
    pub const Possible: Self = Self(1);
    #[doc(alias = "UISpringLoadedInteractionEffectStateActivating")]
    pub const Activating: Self = Self(2);
    #[doc(alias = "UISpringLoadedInteractionEffectStateActivated")]
    pub const Activated: Self = Self(3);
}

unsafe impl Encode for UISpringLoadedInteractionEffectState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UISpringLoadedInteractionEffectState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UISpringLoadedInteraction;

    unsafe impl ClassType for UISpringLoadedInteraction {
        type Super = NSObject;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSObjectProtocol for UISpringLoadedInteraction {}

#[cfg(feature = "UIInteraction")]
unsafe impl UIInteraction for UISpringLoadedInteraction {}

extern_methods!(
    unsafe impl UISpringLoadedInteraction {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "block2")]
        #[method_id(@__retain_semantics Init initWithInteractionBehavior:interactionEffect:activationHandler:)]
        pub unsafe fn initWithInteractionBehavior_interactionEffect_activationHandler(
            this: Allocated<Self>,
            interaction_behavior: Option<&ProtocolObject<dyn UISpringLoadedInteractionBehavior>>,
            interaction_effect: Option<&ProtocolObject<dyn UISpringLoadedInteractionEffect>>,
            handler: &block2::Block<
                dyn Fn(
                    NonNull<UISpringLoadedInteraction>,
                    NonNull<ProtocolObject<dyn UISpringLoadedInteractionContext>>,
                ),
            >,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        #[method_id(@__retain_semantics Init initWithActivationHandler:)]
        pub unsafe fn initWithActivationHandler(
            this: Allocated<Self>,
            handler: &block2::Block<
                dyn Fn(
                    NonNull<UISpringLoadedInteraction>,
                    NonNull<ProtocolObject<dyn UISpringLoadedInteractionContext>>,
                ),
            >,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other interactionBehavior)]
        pub unsafe fn interactionBehavior(
            &self,
        ) -> Retained<ProtocolObject<dyn UISpringLoadedInteractionBehavior>>;

        #[method_id(@__retain_semantics Other interactionEffect)]
        pub unsafe fn interactionEffect(
            &self,
        ) -> Retained<ProtocolObject<dyn UISpringLoadedInteractionEffect>>;
    }
);

extern_protocol!(
    pub unsafe trait UISpringLoadedInteractionBehavior:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[method(shouldAllowInteraction:withContext:)]
        unsafe fn shouldAllowInteraction_withContext(
            &self,
            interaction: &UISpringLoadedInteraction,
            context: &ProtocolObject<dyn UISpringLoadedInteractionContext>,
        ) -> bool;

        #[optional]
        #[method(interactionDidFinish:)]
        unsafe fn interactionDidFinish(&self, interaction: &UISpringLoadedInteraction);
    }

    unsafe impl ProtocolType for dyn UISpringLoadedInteractionBehavior {}
);

extern_protocol!(
    pub unsafe trait UISpringLoadedInteractionEffect:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[method(interaction:didChangeWithContext:)]
        unsafe fn interaction_didChangeWithContext(
            &self,
            interaction: &UISpringLoadedInteraction,
            context: &ProtocolObject<dyn UISpringLoadedInteractionContext>,
        );
    }

    unsafe impl ProtocolType for dyn UISpringLoadedInteractionEffect {}
);

extern_protocol!(
    pub unsafe trait UISpringLoadedInteractionContext:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[method(state)]
        unsafe fn state(&self) -> UISpringLoadedInteractionEffectState;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method_id(@__retain_semantics Other targetView)]
        unsafe fn targetView(&self) -> Option<Retained<UIView>>;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method(setTargetView:)]
        unsafe fn setTargetView(&self, target_view: Option<&UIView>);

        #[method_id(@__retain_semantics Other targetItem)]
        unsafe fn targetItem(&self) -> Option<Retained<AnyObject>>;

        #[method(setTargetItem:)]
        unsafe fn setTargetItem(&self, target_item: Option<&AnyObject>);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method(locationInView:)]
        unsafe fn locationInView(&self, view: Option<&UIView>) -> CGPoint;
    }

    unsafe impl ProtocolType for dyn UISpringLoadedInteractionContext {}
);