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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
//! 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 UINavigationControllerOperation(pub NSInteger);
impl UINavigationControllerOperation {
    #[doc(alias = "UINavigationControllerOperationNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UINavigationControllerOperationPush")]
    pub const Push: Self = Self(1);
    #[doc(alias = "UINavigationControllerOperationPop")]
    pub const Pop: Self = Self(2);
}

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

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

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

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    pub struct UINavigationController;

    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl ClassType for UINavigationController {
        #[inherits(UIResponder, NSObject)]
        type Super = UIViewController;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl NSCoding for UINavigationController {}

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl NSObjectProtocol for UINavigationController {}

#[cfg(all(
    feature = "UIAppearance",
    feature = "UIResponder",
    feature = "UIViewController"
))]
unsafe impl UIAppearanceContainer for UINavigationController {}

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

#[cfg(all(
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIViewController"
))]
unsafe impl UIFocusEnvironment for UINavigationController {}

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
unsafe impl UIResponderStandardEditActions for UINavigationController {}

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIViewController"
))]
unsafe impl UITraitEnvironment for UINavigationController {}

extern_methods!(
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UINavigationController {
        #[method_id(@__retain_semantics Init initWithNavigationBarClass:toolbarClass:)]
        pub unsafe fn initWithNavigationBarClass_toolbarClass(
            this: Allocated<Self>,
            navigation_bar_class: Option<&AnyClass>,
            toolbar_class: Option<&AnyClass>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithRootViewController:)]
        pub unsafe fn initWithRootViewController(
            this: Allocated<Self>,
            root_view_controller: &UIViewController,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithNibName:bundle:)]
        pub unsafe fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSString>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            a_decoder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[method(pushViewController:animated:)]
        pub unsafe fn pushViewController_animated(
            &self,
            view_controller: &UIViewController,
            animated: bool,
        );

        #[method_id(@__retain_semantics Other popViewControllerAnimated:)]
        pub unsafe fn popViewControllerAnimated(
            &self,
            animated: bool,
        ) -> Option<Retained<UIViewController>>;

        #[method_id(@__retain_semantics Other popToViewController:animated:)]
        pub unsafe fn popToViewController_animated(
            &self,
            view_controller: &UIViewController,
            animated: bool,
        ) -> Option<Retained<NSArray<UIViewController>>>;

        #[method_id(@__retain_semantics Other popToRootViewControllerAnimated:)]
        pub unsafe fn popToRootViewControllerAnimated(
            &self,
            animated: bool,
        ) -> Option<Retained<NSArray<UIViewController>>>;

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

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

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

        #[method(setViewControllers:)]
        pub unsafe fn setViewControllers(&self, view_controllers: &NSArray<UIViewController>);

        #[method(setViewControllers:animated:)]
        pub unsafe fn setViewControllers_animated(
            &self,
            view_controllers: &NSArray<UIViewController>,
            animated: bool,
        );

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

        #[method(setNavigationBarHidden:)]
        pub unsafe fn setNavigationBarHidden(&self, navigation_bar_hidden: bool);

        #[method(setNavigationBarHidden:animated:)]
        pub unsafe fn setNavigationBarHidden_animated(&self, hidden: bool, animated: bool);

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

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

        #[method(setToolbarHidden:)]
        pub unsafe fn setToolbarHidden(&self, toolbar_hidden: bool);

        #[method(setToolbarHidden:animated:)]
        pub unsafe fn setToolbarHidden_animated(&self, hidden: bool, animated: bool);

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

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

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

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

        #[method(showViewController:sender:)]
        pub unsafe fn showViewController_sender(
            &self,
            vc: &UIViewController,
            sender: Option<&AnyObject>,
        );

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

        #[method(setHidesBarsWhenKeyboardAppears:)]
        pub unsafe fn setHidesBarsWhenKeyboardAppears(
            &self,
            hides_bars_when_keyboard_appears: bool,
        );

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

        #[method(setHidesBarsOnSwipe:)]
        pub unsafe fn setHidesBarsOnSwipe(&self, hides_bars_on_swipe: bool);

        #[cfg(all(feature = "UIGestureRecognizer", feature = "UIPanGestureRecognizer"))]
        #[method_id(@__retain_semantics Other barHideOnSwipeGestureRecognizer)]
        pub unsafe fn barHideOnSwipeGestureRecognizer(&self) -> Retained<UIPanGestureRecognizer>;

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

        #[method(setHidesBarsWhenVerticallyCompact:)]
        pub unsafe fn setHidesBarsWhenVerticallyCompact(
            &self,
            hides_bars_when_vertically_compact: bool,
        );

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

        #[method(setHidesBarsOnTap:)]
        pub unsafe fn setHidesBarsOnTap(&self, hides_bars_on_tap: bool);

        #[cfg(all(feature = "UIGestureRecognizer", feature = "UITapGestureRecognizer"))]
        #[method_id(@__retain_semantics Other barHideOnTapGestureRecognizer)]
        pub unsafe fn barHideOnTapGestureRecognizer(&self) -> Retained<UITapGestureRecognizer>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UINavigationController {
        #[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>;
    }
);

extern_protocol!(
    pub unsafe trait UINavigationControllerDelegate:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method(navigationController:willShowViewController:animated:)]
        unsafe fn navigationController_willShowViewController_animated(
            &self,
            navigation_controller: &UINavigationController,
            view_controller: &UIViewController,
            animated: bool,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method(navigationController:didShowViewController:animated:)]
        unsafe fn navigationController_didShowViewController_animated(
            &self,
            navigation_controller: &UINavigationController,
            view_controller: &UIViewController,
            animated: bool,
        );

        #[cfg(all(
            feature = "UIOrientation",
            feature = "UIResponder",
            feature = "UIViewController"
        ))]
        #[optional]
        #[method(navigationControllerSupportedInterfaceOrientations:)]
        unsafe fn navigationControllerSupportedInterfaceOrientations(
            &self,
            navigation_controller: &UINavigationController,
        ) -> UIInterfaceOrientationMask;

        #[cfg(all(
            feature = "UIOrientation",
            feature = "UIResponder",
            feature = "UIViewController"
        ))]
        #[optional]
        #[method(navigationControllerPreferredInterfaceOrientationForPresentation:)]
        unsafe fn navigationControllerPreferredInterfaceOrientationForPresentation(
            &self,
            navigation_controller: &UINavigationController,
        ) -> UIInterfaceOrientation;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIViewController",
            feature = "UIViewControllerTransitioning"
        ))]
        #[optional]
        #[method_id(@__retain_semantics Other navigationController:interactionControllerForAnimationController:)]
        unsafe fn navigationController_interactionControllerForAnimationController(
            &self,
            navigation_controller: &UINavigationController,
            animation_controller: &ProtocolObject<dyn UIViewControllerAnimatedTransitioning>,
        ) -> Option<Retained<ProtocolObject<dyn UIViewControllerInteractiveTransitioning>>>;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIViewController",
            feature = "UIViewControllerTransitioning"
        ))]
        #[optional]
        #[method_id(@__retain_semantics Other navigationController:animationControllerForOperation:fromViewController:toViewController:)]
        unsafe fn navigationController_animationControllerForOperation_fromViewController_toViewController(
            &self,
            navigation_controller: &UINavigationController,
            operation: UINavigationControllerOperation,
            from_vc: &UIViewController,
            to_vc: &UIViewController,
        ) -> Option<Retained<ProtocolObject<dyn UIViewControllerAnimatedTransitioning>>>;
    }

    unsafe impl ProtocolType for dyn UINavigationControllerDelegate {}
);

extern_methods!(
    /// UINavigationControllerItem
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UIViewController {
        #[cfg(feature = "UINavigationItem")]
        #[method_id(@__retain_semantics Other navigationItem)]
        pub unsafe fn navigationItem(&self) -> Retained<UINavigationItem>;

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

        #[method(setHidesBottomBarWhenPushed:)]
        pub unsafe fn setHidesBottomBarWhenPushed(&self, hides_bottom_bar_when_pushed: bool);

        #[method_id(@__retain_semantics Other navigationController)]
        pub unsafe fn navigationController(&self) -> Option<Retained<UINavigationController>>;
    }
);

extern_methods!(
    /// UINavigationControllerContextualToolbarItems
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UIViewController {
        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method_id(@__retain_semantics Other toolbarItems)]
        pub unsafe fn toolbarItems(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setToolbarItems:)]
        pub unsafe fn setToolbarItems(&self, toolbar_items: Option<&NSArray<UIBarButtonItem>>);

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setToolbarItems:animated:)]
        pub unsafe fn setToolbarItems_animated(
            &self,
            toolbar_items: Option<&NSArray<UIBarButtonItem>>,
            animated: bool,
        );
    }
);