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
//! 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 UIPageViewControllerNavigationOrientation(pub NSInteger);
impl UIPageViewControllerNavigationOrientation {
    #[doc(alias = "UIPageViewControllerNavigationOrientationHorizontal")]
    pub const Horizontal: Self = Self(0);
    #[doc(alias = "UIPageViewControllerNavigationOrientationVertical")]
    pub const Vertical: Self = Self(1);
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPageViewControllerSpineLocation(pub NSInteger);
impl UIPageViewControllerSpineLocation {
    #[doc(alias = "UIPageViewControllerSpineLocationNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UIPageViewControllerSpineLocationMin")]
    pub const Min: Self = Self(1);
    #[doc(alias = "UIPageViewControllerSpineLocationMid")]
    pub const Mid: Self = Self(2);
    #[doc(alias = "UIPageViewControllerSpineLocationMax")]
    pub const Max: Self = Self(3);
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPageViewControllerNavigationDirection(pub NSInteger);
impl UIPageViewControllerNavigationDirection {
    #[doc(alias = "UIPageViewControllerNavigationDirectionForward")]
    pub const Forward: Self = Self(0);
    #[doc(alias = "UIPageViewControllerNavigationDirectionReverse")]
    pub const Reverse: Self = Self(1);
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPageViewControllerTransitionStyle(pub NSInteger);
impl UIPageViewControllerTransitionStyle {
    #[doc(alias = "UIPageViewControllerTransitionStylePageCurl")]
    pub const PageCurl: Self = Self(0);
    #[doc(alias = "UIPageViewControllerTransitionStyleScroll")]
    pub const Scroll: Self = Self(1);
}

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

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

// NS_TYPED_ENUM
pub type UIPageViewControllerOptionsKey = NSString;

extern "C" {
    pub static UIPageViewControllerOptionSpineLocationKey: &'static UIPageViewControllerOptionsKey;
}

extern "C" {
    pub static UIPageViewControllerOptionInterPageSpacingKey:
        &'static UIPageViewControllerOptionsKey;
}

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

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

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

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

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

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

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

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

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

extern_methods!(
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UIPageViewController {
        #[method_id(@__retain_semantics Init initWithTransitionStyle:navigationOrientation:options:)]
        pub unsafe fn initWithTransitionStyle_navigationOrientation_options(
            this: Allocated<Self>,
            style: UIPageViewControllerTransitionStyle,
            navigation_orientation: UIPageViewControllerNavigationOrientation,
            options: Option<&NSDictionary<UIPageViewControllerOptionsKey, AnyObject>>,
        ) -> Retained<Self>;

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

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

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

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

        #[method(setDataSource:)]
        pub unsafe fn setDataSource(
            &self,
            data_source: Option<&ProtocolObject<dyn UIPageViewControllerDataSource>>,
        );

        #[method(transitionStyle)]
        pub unsafe fn transitionStyle(&self) -> UIPageViewControllerTransitionStyle;

        #[method(navigationOrientation)]
        pub unsafe fn navigationOrientation(&self) -> UIPageViewControllerNavigationOrientation;

        #[method(spineLocation)]
        pub unsafe fn spineLocation(&self) -> UIPageViewControllerSpineLocation;

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

        #[method(setDoubleSided:)]
        pub unsafe fn setDoubleSided(&self, double_sided: bool);

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

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

        #[cfg(feature = "block2")]
        #[method(setViewControllers:direction:animated:completion:)]
        pub unsafe fn setViewControllers_direction_animated_completion(
            &self,
            view_controllers: Option<&NSArray<UIViewController>>,
            direction: UIPageViewControllerNavigationDirection,
            animated: bool,
            completion: Option<&block2::Block<dyn Fn(Bool)>>,
        );
    }
);

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

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    unsafe impl UIPageViewController {
        #[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 UIPageViewControllerDelegate:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method(pageViewController:willTransitionToViewControllers:)]
        unsafe fn pageViewController_willTransitionToViewControllers(
            &self,
            page_view_controller: &UIPageViewController,
            pending_view_controllers: &NSArray<UIViewController>,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method(pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted:)]
        unsafe fn pageViewController_didFinishAnimating_previousViewControllers_transitionCompleted(
            &self,
            page_view_controller: &UIPageViewController,
            finished: bool,
            previous_view_controllers: &NSArray<UIViewController>,
            completed: bool,
        );

        #[cfg(all(
            feature = "UIOrientation",
            feature = "UIResponder",
            feature = "UIViewController"
        ))]
        #[optional]
        #[method(pageViewController:spineLocationForInterfaceOrientation:)]
        unsafe fn pageViewController_spineLocationForInterfaceOrientation(
            &self,
            page_view_controller: &UIPageViewController,
            orientation: UIInterfaceOrientation,
        ) -> UIPageViewControllerSpineLocation;

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

        #[cfg(all(
            feature = "UIOrientation",
            feature = "UIResponder",
            feature = "UIViewController"
        ))]
        #[optional]
        #[method(pageViewControllerPreferredInterfaceOrientationForPresentation:)]
        unsafe fn pageViewControllerPreferredInterfaceOrientationForPresentation(
            &self,
            page_view_controller: &UIPageViewController,
        ) -> UIInterfaceOrientation;
    }

    unsafe impl ProtocolType for dyn UIPageViewControllerDelegate {}
);

extern_protocol!(
    pub unsafe trait UIPageViewControllerDataSource:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[method_id(@__retain_semantics Other pageViewController:viewControllerBeforeViewController:)]
        unsafe fn pageViewController_viewControllerBeforeViewController(
            &self,
            page_view_controller: &UIPageViewController,
            view_controller: &UIViewController,
        ) -> Option<Retained<UIViewController>>;

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[method_id(@__retain_semantics Other pageViewController:viewControllerAfterViewController:)]
        unsafe fn pageViewController_viewControllerAfterViewController(
            &self,
            page_view_controller: &UIPageViewController,
            view_controller: &UIViewController,
        ) -> Option<Retained<UIViewController>>;

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method(presentationCountForPageViewController:)]
        unsafe fn presentationCountForPageViewController(
            &self,
            page_view_controller: &UIPageViewController,
        ) -> NSInteger;

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[method(presentationIndexForPageViewController:)]
        unsafe fn presentationIndexForPageViewController(
            &self,
            page_view_controller: &UIPageViewController,
        ) -> NSInteger;
    }

    unsafe impl ProtocolType for dyn UIPageViewControllerDataSource {}
);