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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_TYPED_EXTENSIBLE_ENUM
pub type UISheetPresentationControllerDetentIdentifier = NSString;

extern "C" {
    pub static UISheetPresentationControllerDetentIdentifierMedium:
        &'static UISheetPresentationControllerDetentIdentifier;
}

extern "C" {
    pub static UISheetPresentationControllerDetentIdentifierLarge:
        &'static UISheetPresentationControllerDetentIdentifier;
}

extern "C" {
    pub static UISheetPresentationControllerDetentInactive: CGFloat;
}

extern_protocol!(
    pub unsafe trait UISheetPresentationControllerDetentResolutionContext:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[cfg(feature = "UITraitCollection")]
        #[method_id(@__retain_semantics Other containerTraitCollection)]
        unsafe fn containerTraitCollection(&self) -> Retained<UITraitCollection>;

        #[method(maximumDetentValue)]
        unsafe fn maximumDetentValue(&self) -> CGFloat;
    }

    unsafe impl ProtocolType for dyn UISheetPresentationControllerDetentResolutionContext {}
);

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

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

unsafe impl NSObjectProtocol for UISheetPresentationControllerDetent {}

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

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

        #[method_id(@__retain_semantics Other mediumDetent)]
        pub unsafe fn mediumDetent(mtm: MainThreadMarker) -> Retained<Self>;

        #[method_id(@__retain_semantics Other largeDetent)]
        pub unsafe fn largeDetent(mtm: MainThreadMarker) -> Retained<Self>;

        #[cfg(feature = "block2")]
        #[method_id(@__retain_semantics Other customDetentWithIdentifier:resolver:)]
        pub unsafe fn customDetentWithIdentifier_resolver(
            identifier: Option<&UISheetPresentationControllerDetentIdentifier>,
            resolver: &block2::Block<
                dyn Fn(
                    NonNull<
                        ProtocolObject<dyn UISheetPresentationControllerDetentResolutionContext>,
                    >,
                ) -> CGFloat,
            >,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other identifier)]
        pub unsafe fn identifier(&self) -> Retained<UISheetPresentationControllerDetentIdentifier>;

        #[method(resolvedValueInContext:)]
        pub unsafe fn resolvedValueInContext(
            &self,
            context: &ProtocolObject<dyn UISheetPresentationControllerDetentResolutionContext>,
        ) -> CGFloat;
    }
);

extern "C" {
    pub static UISheetPresentationControllerAutomaticDimension: CGFloat;
}

extern_protocol!(
    #[cfg(feature = "UIPresentationController")]
    pub unsafe trait UISheetPresentationControllerDelegate:
        UIAdaptivePresentationControllerDelegate + IsMainThreadOnly
    {
        #[optional]
        #[method(sheetPresentationControllerDidChangeSelectedDetentIdentifier:)]
        unsafe fn sheetPresentationControllerDidChangeSelectedDetentIdentifier(
            &self,
            sheet_presentation_controller: &UISheetPresentationController,
        );
    }

    #[cfg(feature = "UIPresentationController")]
    unsafe impl ProtocolType for dyn UISheetPresentationControllerDelegate {}
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "UIPresentationController")]
    pub struct UISheetPresentationController;

    #[cfg(feature = "UIPresentationController")]
    unsafe impl ClassType for UISheetPresentationController {
        #[inherits(NSObject)]
        type Super = UIPresentationController;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(feature = "UIPresentationController")]
unsafe impl NSObjectProtocol for UISheetPresentationController {}

#[cfg(all(feature = "UIAppearance", feature = "UIPresentationController"))]
unsafe impl UIAppearanceContainer for UISheetPresentationController {}

#[cfg(all(feature = "UIPresentationController", feature = "UIViewController"))]
unsafe impl UIContentContainer for UISheetPresentationController {}

#[cfg(all(feature = "UIFocus", feature = "UIPresentationController"))]
unsafe impl UIFocusEnvironment for UISheetPresentationController {}

#[cfg(all(feature = "UIPresentationController", feature = "UITraitCollection"))]
unsafe impl UITraitEnvironment for UISheetPresentationController {}

extern_methods!(
    #[cfg(feature = "UIPresentationController")]
    unsafe impl UISheetPresentationController {
        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UISheetPresentationControllerDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UISheetPresentationControllerDelegate>>,
        );

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

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

        #[method(prefersPageSizing)]
        pub unsafe fn prefersPageSizing(&self) -> bool;

        #[method(setPrefersPageSizing:)]
        pub unsafe fn setPrefersPageSizing(&self, prefers_page_sizing: bool);

        #[method(prefersEdgeAttachedInCompactHeight)]
        pub unsafe fn prefersEdgeAttachedInCompactHeight(&self) -> bool;

        #[method(setPrefersEdgeAttachedInCompactHeight:)]
        pub unsafe fn setPrefersEdgeAttachedInCompactHeight(
            &self,
            prefers_edge_attached_in_compact_height: bool,
        );

        #[method(widthFollowsPreferredContentSizeWhenEdgeAttached)]
        pub unsafe fn widthFollowsPreferredContentSizeWhenEdgeAttached(&self) -> bool;

        #[method(setWidthFollowsPreferredContentSizeWhenEdgeAttached:)]
        pub unsafe fn setWidthFollowsPreferredContentSizeWhenEdgeAttached(
            &self,
            width_follows_preferred_content_size_when_edge_attached: bool,
        );

        #[method(prefersGrabberVisible)]
        pub unsafe fn prefersGrabberVisible(&self) -> bool;

        #[method(setPrefersGrabberVisible:)]
        pub unsafe fn setPrefersGrabberVisible(&self, prefers_grabber_visible: bool);

        #[method(preferredCornerRadius)]
        pub unsafe fn preferredCornerRadius(&self) -> CGFloat;

        #[method(setPreferredCornerRadius:)]
        pub unsafe fn setPreferredCornerRadius(&self, preferred_corner_radius: CGFloat);

        #[method_id(@__retain_semantics Other detents)]
        pub unsafe fn detents(&self) -> Retained<NSArray<UISheetPresentationControllerDetent>>;

        #[method(setDetents:)]
        pub unsafe fn setDetents(&self, detents: &NSArray<UISheetPresentationControllerDetent>);

        #[method(invalidateDetents)]
        pub unsafe fn invalidateDetents(&self);

        #[method_id(@__retain_semantics Other selectedDetentIdentifier)]
        pub unsafe fn selectedDetentIdentifier(
            &self,
        ) -> Option<Retained<UISheetPresentationControllerDetentIdentifier>>;

        #[method(setSelectedDetentIdentifier:)]
        pub unsafe fn setSelectedDetentIdentifier(
            &self,
            selected_detent_identifier: Option<&UISheetPresentationControllerDetentIdentifier>,
        );

        #[method_id(@__retain_semantics Other largestUndimmedDetentIdentifier)]
        pub unsafe fn largestUndimmedDetentIdentifier(
            &self,
        ) -> Option<Retained<UISheetPresentationControllerDetentIdentifier>>;

        #[method(setLargestUndimmedDetentIdentifier:)]
        pub unsafe fn setLargestUndimmedDetentIdentifier(
            &self,
            largest_undimmed_detent_identifier: Option<
                &UISheetPresentationControllerDetentIdentifier,
            >,
        );

        #[method(prefersScrollingExpandsWhenScrolledToEdge)]
        pub unsafe fn prefersScrollingExpandsWhenScrolledToEdge(&self) -> bool;

        #[method(setPrefersScrollingExpandsWhenScrolledToEdge:)]
        pub unsafe fn setPrefersScrollingExpandsWhenScrolledToEdge(
            &self,
            prefers_scrolling_expands_when_scrolled_to_edge: bool,
        );

        #[cfg(feature = "block2")]
        #[method(animateChanges:)]
        pub unsafe fn animateChanges(&self, changes: &block2::Block<dyn Fn() + '_>);
    }
);

extern_methods!(
    /// Methods declared on superclass `UIPresentationController`
    #[cfg(feature = "UIPresentationController")]
    unsafe impl UISheetPresentationController {
        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[method_id(@__retain_semantics Init initWithPresentedViewController:presentingViewController:)]
        pub unsafe fn initWithPresentedViewController_presentingViewController(
            this: Allocated<Self>,
            presented_view_controller: &UIViewController,
            presenting_view_controller: Option<&UIViewController>,
        ) -> Retained<Self>;

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

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "UIPresentationController")]
    unsafe impl UISheetPresentationController {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);