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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIScrollViewIndicatorStyle(pub NSInteger);
impl UIScrollViewIndicatorStyle {
    #[doc(alias = "UIScrollViewIndicatorStyleDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "UIScrollViewIndicatorStyleBlack")]
    pub const Black: Self = Self(1);
    #[doc(alias = "UIScrollViewIndicatorStyleWhite")]
    pub const White: Self = Self(2);
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIScrollViewKeyboardDismissMode(pub NSInteger);
impl UIScrollViewKeyboardDismissMode {
    #[doc(alias = "UIScrollViewKeyboardDismissModeNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UIScrollViewKeyboardDismissModeOnDrag")]
    pub const OnDrag: Self = Self(1);
    #[doc(alias = "UIScrollViewKeyboardDismissModeInteractive")]
    pub const Interactive: Self = Self(2);
    #[doc(alias = "UIScrollViewKeyboardDismissModeOnDragWithAccessory")]
    pub const OnDragWithAccessory: Self = Self(3);
    #[doc(alias = "UIScrollViewKeyboardDismissModeInteractiveWithAccessory")]
    pub const InteractiveWithAccessory: Self = Self(4);
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIScrollViewIndexDisplayMode(pub NSInteger);
impl UIScrollViewIndexDisplayMode {
    #[doc(alias = "UIScrollViewIndexDisplayModeAutomatic")]
    pub const Automatic: Self = Self(0);
    #[doc(alias = "UIScrollViewIndexDisplayModeAlwaysHidden")]
    pub const AlwaysHidden: Self = Self(1);
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIScrollViewContentInsetAdjustmentBehavior(pub NSInteger);
impl UIScrollViewContentInsetAdjustmentBehavior {
    pub const UIScrollViewContentInsetAdjustmentAutomatic: Self = Self(0);
    pub const UIScrollViewContentInsetAdjustmentScrollableAxes: Self = Self(1);
    pub const UIScrollViewContentInsetAdjustmentNever: Self = Self(2);
    pub const UIScrollViewContentInsetAdjustmentAlways: Self = Self(3);
}

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

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

// NS_TYPED_ENUM
pub type UIScrollViewDecelerationRate = CGFloat;

extern "C" {
    pub static UIScrollViewDecelerationRateNormal: UIScrollViewDecelerationRate;
}

extern "C" {
    pub static UIScrollViewDecelerationRateFast: UIScrollViewDecelerationRate;
}

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

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

#[cfg(all(
    feature = "UIResponder",
    feature = "UIView",
    feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
unsafe impl CALayerDelegate for UIScrollView {}

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

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

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIAppearance for UIScrollView {}

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

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
unsafe impl UICoordinateSpace for UIScrollView {}

#[cfg(all(
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIDynamicItem for UIScrollView {}

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

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIFocusItem for UIScrollView {}

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIFocusItemContainer for UIScrollView {}

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIFocusItemScrollableContainer for UIScrollView {}

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

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

extern_methods!(
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    unsafe impl UIScrollView {
        #[method(contentOffset)]
        pub unsafe fn contentOffset(&self) -> CGPoint;

        #[method(setContentOffset:)]
        pub unsafe fn setContentOffset(&self, content_offset: CGPoint);

        #[method(contentSize)]
        pub unsafe fn contentSize(&self) -> CGSize;

        #[method(setContentSize:)]
        pub unsafe fn setContentSize(&self, content_size: CGSize);

        #[cfg(feature = "UIGeometry")]
        #[method(contentInset)]
        pub unsafe fn contentInset(&self) -> UIEdgeInsets;

        #[cfg(feature = "UIGeometry")]
        #[method(setContentInset:)]
        pub unsafe fn setContentInset(&self, content_inset: UIEdgeInsets);

        #[method(contentAlignmentPoint)]
        pub unsafe fn contentAlignmentPoint(&self) -> CGPoint;

        #[method(setContentAlignmentPoint:)]
        pub unsafe fn setContentAlignmentPoint(&self, content_alignment_point: CGPoint);

        #[cfg(feature = "UIGeometry")]
        #[method(adjustedContentInset)]
        pub unsafe fn adjustedContentInset(&self) -> UIEdgeInsets;

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

        #[method(contentInsetAdjustmentBehavior)]
        pub unsafe fn contentInsetAdjustmentBehavior(
            &self,
        ) -> UIScrollViewContentInsetAdjustmentBehavior;

        #[method(setContentInsetAdjustmentBehavior:)]
        pub unsafe fn setContentInsetAdjustmentBehavior(
            &self,
            content_inset_adjustment_behavior: UIScrollViewContentInsetAdjustmentBehavior,
        );

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

        #[method(setAutomaticallyAdjustsScrollIndicatorInsets:)]
        pub unsafe fn setAutomaticallyAdjustsScrollIndicatorInsets(
            &self,
            automatically_adjusts_scroll_indicator_insets: bool,
        );

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

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

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

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

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

        #[method(setDirectionalLockEnabled:)]
        pub unsafe fn setDirectionalLockEnabled(&self, directional_lock_enabled: bool);

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

        #[method(setBounces:)]
        pub unsafe fn setBounces(&self, bounces: bool);

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

        #[method(setBouncesHorizontally:)]
        pub unsafe fn setBouncesHorizontally(&self, bounces_horizontally: bool);

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

        #[method(setBouncesVertically:)]
        pub unsafe fn setBouncesVertically(&self, bounces_vertically: bool);

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

        #[method(setAlwaysBounceVertical:)]
        pub unsafe fn setAlwaysBounceVertical(&self, always_bounce_vertical: bool);

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

        #[method(setAlwaysBounceHorizontal:)]
        pub unsafe fn setAlwaysBounceHorizontal(&self, always_bounce_horizontal: bool);

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

        #[method(setPagingEnabled:)]
        pub unsafe fn setPagingEnabled(&self, paging_enabled: bool);

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

        #[method(setScrollEnabled:)]
        pub unsafe fn setScrollEnabled(&self, scroll_enabled: bool);

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

        #[method(setTransfersHorizontalScrollingToParent:)]
        pub unsafe fn setTransfersHorizontalScrollingToParent(
            &self,
            transfers_horizontal_scrolling_to_parent: bool,
        );

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

        #[method(setTransfersVerticalScrollingToParent:)]
        pub unsafe fn setTransfersVerticalScrollingToParent(
            &self,
            transfers_vertical_scrolling_to_parent: bool,
        );

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

        #[method(setShowsVerticalScrollIndicator:)]
        pub unsafe fn setShowsVerticalScrollIndicator(&self, shows_vertical_scroll_indicator: bool);

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

        #[method(setShowsHorizontalScrollIndicator:)]
        pub unsafe fn setShowsHorizontalScrollIndicator(
            &self,
            shows_horizontal_scroll_indicator: bool,
        );

        #[method(indicatorStyle)]
        pub unsafe fn indicatorStyle(&self) -> UIScrollViewIndicatorStyle;

        #[method(setIndicatorStyle:)]
        pub unsafe fn setIndicatorStyle(&self, indicator_style: UIScrollViewIndicatorStyle);

        #[cfg(feature = "UIGeometry")]
        #[method(verticalScrollIndicatorInsets)]
        pub unsafe fn verticalScrollIndicatorInsets(&self) -> UIEdgeInsets;

        #[cfg(feature = "UIGeometry")]
        #[method(setVerticalScrollIndicatorInsets:)]
        pub unsafe fn setVerticalScrollIndicatorInsets(
            &self,
            vertical_scroll_indicator_insets: UIEdgeInsets,
        );

        #[cfg(feature = "UIGeometry")]
        #[method(horizontalScrollIndicatorInsets)]
        pub unsafe fn horizontalScrollIndicatorInsets(&self) -> UIEdgeInsets;

        #[cfg(feature = "UIGeometry")]
        #[method(setHorizontalScrollIndicatorInsets:)]
        pub unsafe fn setHorizontalScrollIndicatorInsets(
            &self,
            horizontal_scroll_indicator_insets: UIEdgeInsets,
        );

        #[cfg(feature = "UIGeometry")]
        #[method(scrollIndicatorInsets)]
        pub unsafe fn scrollIndicatorInsets(&self) -> UIEdgeInsets;

        #[cfg(feature = "UIGeometry")]
        #[method(setScrollIndicatorInsets:)]
        pub unsafe fn setScrollIndicatorInsets(&self, scroll_indicator_insets: UIEdgeInsets);

        #[method(decelerationRate)]
        pub unsafe fn decelerationRate(&self) -> UIScrollViewDecelerationRate;

        #[method(setDecelerationRate:)]
        pub unsafe fn setDecelerationRate(&self, deceleration_rate: UIScrollViewDecelerationRate);

        #[method(indexDisplayMode)]
        pub unsafe fn indexDisplayMode(&self) -> UIScrollViewIndexDisplayMode;

        #[method(setIndexDisplayMode:)]
        pub unsafe fn setIndexDisplayMode(&self, index_display_mode: UIScrollViewIndexDisplayMode);

        #[method(setContentOffset:animated:)]
        pub unsafe fn setContentOffset_animated(&self, content_offset: CGPoint, animated: bool);

        #[method(scrollRectToVisible:animated:)]
        pub unsafe fn scrollRectToVisible_animated(&self, rect: CGRect, animated: bool);

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

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

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

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

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

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

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

        #[method(setDelaysContentTouches:)]
        pub unsafe fn setDelaysContentTouches(&self, delays_content_touches: bool);

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

        #[method(setCanCancelContentTouches:)]
        pub unsafe fn setCanCancelContentTouches(&self, can_cancel_content_touches: bool);

        #[cfg(all(feature = "UIEvent", feature = "UITouch"))]
        #[method(touchesShouldBegin:withEvent:inContentView:)]
        pub unsafe fn touchesShouldBegin_withEvent_inContentView(
            &self,
            touches: &NSSet<UITouch>,
            event: Option<&UIEvent>,
            view: &UIView,
        ) -> bool;

        #[method(touchesShouldCancelInContentView:)]
        pub unsafe fn touchesShouldCancelInContentView(&self, view: &UIView) -> bool;

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

        #[method(setMinimumZoomScale:)]
        pub unsafe fn setMinimumZoomScale(&self, minimum_zoom_scale: CGFloat);

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

        #[method(setMaximumZoomScale:)]
        pub unsafe fn setMaximumZoomScale(&self, maximum_zoom_scale: CGFloat);

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

        #[method(setZoomScale:)]
        pub unsafe fn setZoomScale(&self, zoom_scale: CGFloat);

        #[method(setZoomScale:animated:)]
        pub unsafe fn setZoomScale_animated(&self, scale: CGFloat, animated: bool);

        #[method(zoomToRect:animated:)]
        pub unsafe fn zoomToRect_animated(&self, rect: CGRect, animated: bool);

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

        #[method(setBouncesZoom:)]
        pub unsafe fn setBouncesZoom(&self, bounces_zoom: bool);

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

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

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

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

        #[method(setScrollsToTop:)]
        pub unsafe fn setScrollsToTop(&self, scrolls_to_top: bool);

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

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

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

        #[cfg(feature = "UIGestureRecognizer")]
        #[deprecated = "Configuring the panGestureRecognizer for indirect scrolling automatically supports directional presses now, so this property is no longer useful."]
        #[method_id(@__retain_semantics Other directionalPressGestureRecognizer)]
        pub unsafe fn directionalPressGestureRecognizer(&self) -> Retained<UIGestureRecognizer>;

        #[method(keyboardDismissMode)]
        pub unsafe fn keyboardDismissMode(&self) -> UIScrollViewKeyboardDismissMode;

        #[method(setKeyboardDismissMode:)]
        pub unsafe fn setKeyboardDismissMode(
            &self,
            keyboard_dismiss_mode: UIScrollViewKeyboardDismissMode,
        );

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

        #[cfg(all(feature = "UIControl", feature = "UIRefreshControl"))]
        #[method(setRefreshControl:)]
        pub unsafe fn setRefreshControl(&self, refresh_control: Option<&UIRefreshControl>);

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

        #[method(setAllowsKeyboardScrolling:)]
        pub unsafe fn setAllowsKeyboardScrolling(&self, allows_keyboard_scrolling: bool);
    }
);

extern_methods!(
    /// Methods declared on superclass `UIView`
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    unsafe impl UIScrollView {
        #[method_id(@__retain_semantics Init initWithFrame:)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

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

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    unsafe impl UIScrollView {
        #[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 UIScrollViewDelegate: NSObjectProtocol + IsMainThreadOnly {
        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewDidScroll:)]
        unsafe fn scrollViewDidScroll(&self, scroll_view: &UIScrollView);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewDidZoom:)]
        unsafe fn scrollViewDidZoom(&self, scroll_view: &UIScrollView);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewWillBeginDragging:)]
        unsafe fn scrollViewWillBeginDragging(&self, scroll_view: &UIScrollView);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewWillEndDragging:withVelocity:targetContentOffset:)]
        unsafe fn scrollViewWillEndDragging_withVelocity_targetContentOffset(
            &self,
            scroll_view: &UIScrollView,
            velocity: CGPoint,
            target_content_offset: NonNull<CGPoint>,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewDidEndDragging:willDecelerate:)]
        unsafe fn scrollViewDidEndDragging_willDecelerate(
            &self,
            scroll_view: &UIScrollView,
            decelerate: bool,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewWillBeginDecelerating:)]
        unsafe fn scrollViewWillBeginDecelerating(&self, scroll_view: &UIScrollView);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewDidEndDecelerating:)]
        unsafe fn scrollViewDidEndDecelerating(&self, scroll_view: &UIScrollView);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewDidEndScrollingAnimation:)]
        unsafe fn scrollViewDidEndScrollingAnimation(&self, scroll_view: &UIScrollView);

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

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewWillBeginZooming:withView:)]
        unsafe fn scrollViewWillBeginZooming_withView(
            &self,
            scroll_view: &UIScrollView,
            view: Option<&UIView>,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewDidEndZooming:withView:atScale:)]
        unsafe fn scrollViewDidEndZooming_withView_atScale(
            &self,
            scroll_view: &UIScrollView,
            view: Option<&UIView>,
            scale: CGFloat,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewShouldScrollToTop:)]
        unsafe fn scrollViewShouldScrollToTop(&self, scroll_view: &UIScrollView) -> bool;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewDidScrollToTop:)]
        unsafe fn scrollViewDidScrollToTop(&self, scroll_view: &UIScrollView);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(scrollViewDidChangeAdjustedContentInset:)]
        unsafe fn scrollViewDidChangeAdjustedContentInset(&self, scroll_view: &UIScrollView);
    }

    unsafe impl ProtocolType for dyn UIScrollViewDelegate {}
);