objc2_ui_kit/generated/
UICollectionView.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewscrollposition?language=objc)
16// NS_OPTIONS
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UICollectionViewScrollPosition(pub NSUInteger);
20bitflags::bitflags! {
21    impl UICollectionViewScrollPosition: NSUInteger {
22        #[doc(alias = "UICollectionViewScrollPositionNone")]
23        const None = 0;
24        #[doc(alias = "UICollectionViewScrollPositionTop")]
25        const Top = 1<<0;
26        #[doc(alias = "UICollectionViewScrollPositionCenteredVertically")]
27        const CenteredVertically = 1<<1;
28        #[doc(alias = "UICollectionViewScrollPositionBottom")]
29        const Bottom = 1<<2;
30        #[doc(alias = "UICollectionViewScrollPositionLeft")]
31        const Left = 1<<3;
32        #[doc(alias = "UICollectionViewScrollPositionCenteredHorizontally")]
33        const CenteredHorizontally = 1<<4;
34        #[doc(alias = "UICollectionViewScrollPositionRight")]
35        const Right = 1<<5;
36    }
37}
38
39unsafe impl Encode for UICollectionViewScrollPosition {
40    const ENCODING: Encoding = NSUInteger::ENCODING;
41}
42
43unsafe impl RefEncode for UICollectionViewScrollPosition {
44    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewreorderingcadence?language=objc)
48// NS_ENUM
49#[repr(transparent)]
50#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
51pub struct UICollectionViewReorderingCadence(pub NSInteger);
52impl UICollectionViewReorderingCadence {
53    #[doc(alias = "UICollectionViewReorderingCadenceImmediate")]
54    pub const Immediate: Self = Self(0);
55    #[doc(alias = "UICollectionViewReorderingCadenceFast")]
56    pub const Fast: Self = Self(1);
57    #[doc(alias = "UICollectionViewReorderingCadenceSlow")]
58    pub const Slow: Self = Self(2);
59}
60
61unsafe impl Encode for UICollectionViewReorderingCadence {
62    const ENCODING: Encoding = NSInteger::ENCODING;
63}
64
65unsafe impl RefEncode for UICollectionViewReorderingCadence {
66    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
67}
68
69/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewselfsizinginvalidation?language=objc)
70// NS_ENUM
71#[repr(transparent)]
72#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
73pub struct UICollectionViewSelfSizingInvalidation(pub NSInteger);
74impl UICollectionViewSelfSizingInvalidation {
75    /// No updates will take place when -invalidateIntrinsicContentSize is called on a self-sizing cell or its contentView.
76    #[doc(alias = "UICollectionViewSelfSizingInvalidationDisabled")]
77    pub const Disabled: Self = Self(0);
78    /// Calling -invalidateIntrinsicContentSize on a self-sizing cell or its contentView will cause it to be resized if necessary.
79    #[doc(alias = "UICollectionViewSelfSizingInvalidationEnabled")]
80    pub const Enabled: Self = Self(1);
81    /// Calling -invalidateIntrinsicContentSize on a self-sizing cell or its contentView will cause it to be resized if necessary, and
82    /// any Auto Layout changes within the contentView of a self-sizing cell will automatically trigger -invalidateIntrinsicContentSize.
83    #[doc(alias = "UICollectionViewSelfSizingInvalidationEnabledIncludingConstraints")]
84    pub const EnabledIncludingConstraints: Self = Self(2);
85}
86
87unsafe impl Encode for UICollectionViewSelfSizingInvalidation {
88    const ENCODING: Encoding = NSInteger::ENCODING;
89}
90
91unsafe impl RefEncode for UICollectionViewSelfSizingInvalidation {
92    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
93}
94
95/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewlayoutinteractivetransitioncompletion?language=objc)
96#[cfg(feature = "block2")]
97pub type UICollectionViewLayoutInteractiveTransitionCompletion =
98    *mut block2::DynBlock<dyn Fn(Bool, Bool)>;
99
100extern_class!(
101    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewfocusupdatecontext?language=objc)
102    #[unsafe(super(UIFocusUpdateContext, NSObject))]
103    #[thread_kind = MainThreadOnly]
104    #[derive(Debug, PartialEq, Eq, Hash)]
105    #[cfg(feature = "UIFocus")]
106    pub struct UICollectionViewFocusUpdateContext;
107);
108
109#[cfg(feature = "UIFocus")]
110extern_conformance!(
111    unsafe impl NSObjectProtocol for UICollectionViewFocusUpdateContext {}
112);
113
114#[cfg(feature = "UIFocus")]
115impl UICollectionViewFocusUpdateContext {
116    extern_methods!(
117        #[unsafe(method(previouslyFocusedIndexPath))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn previouslyFocusedIndexPath(&self) -> Option<Retained<NSIndexPath>>;
120
121        #[unsafe(method(nextFocusedIndexPath))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn nextFocusedIndexPath(&self) -> Option<Retained<NSIndexPath>>;
124    );
125}
126
127/// Methods declared on superclass `NSObject`.
128#[cfg(feature = "UIFocus")]
129impl UICollectionViewFocusUpdateContext {
130    extern_methods!(
131        #[unsafe(method(init))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
134
135        #[unsafe(method(new))]
136        #[unsafe(method_family = new)]
137        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
138    );
139}
140
141extern_protocol!(
142    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdatasource?language=objc)
143    pub unsafe trait UICollectionViewDataSource: NSObjectProtocol + MainThreadOnly {
144        #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
145        #[unsafe(method(collectionView:numberOfItemsInSection:))]
146        #[unsafe(method_family = none)]
147        unsafe fn collectionView_numberOfItemsInSection(
148            &self,
149            collection_view: &UICollectionView,
150            section: NSInteger,
151        ) -> NSInteger;
152
153        #[cfg(all(
154            feature = "UICollectionViewCell",
155            feature = "UIResponder",
156            feature = "UIScrollView",
157            feature = "UIView"
158        ))]
159        #[unsafe(method(collectionView:cellForItemAtIndexPath:))]
160        #[unsafe(method_family = none)]
161        unsafe fn collectionView_cellForItemAtIndexPath(
162            &self,
163            collection_view: &UICollectionView,
164            index_path: &NSIndexPath,
165        ) -> Retained<UICollectionViewCell>;
166
167        #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
168        #[optional]
169        #[unsafe(method(numberOfSectionsInCollectionView:))]
170        #[unsafe(method_family = none)]
171        unsafe fn numberOfSectionsInCollectionView(
172            &self,
173            collection_view: &UICollectionView,
174        ) -> NSInteger;
175
176        #[cfg(all(
177            feature = "UICollectionViewCell",
178            feature = "UIResponder",
179            feature = "UIScrollView",
180            feature = "UIView"
181        ))]
182        #[optional]
183        #[unsafe(method(collectionView:viewForSupplementaryElementOfKind:atIndexPath:))]
184        #[unsafe(method_family = none)]
185        unsafe fn collectionView_viewForSupplementaryElementOfKind_atIndexPath(
186            &self,
187            collection_view: &UICollectionView,
188            kind: &NSString,
189            index_path: &NSIndexPath,
190        ) -> Retained<UICollectionReusableView>;
191
192        #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
193        #[optional]
194        #[unsafe(method(collectionView:canMoveItemAtIndexPath:))]
195        #[unsafe(method_family = none)]
196        unsafe fn collectionView_canMoveItemAtIndexPath(
197            &self,
198            collection_view: &UICollectionView,
199            index_path: &NSIndexPath,
200        ) -> bool;
201
202        #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
203        #[optional]
204        #[unsafe(method(collectionView:moveItemAtIndexPath:toIndexPath:))]
205        #[unsafe(method_family = none)]
206        unsafe fn collectionView_moveItemAtIndexPath_toIndexPath(
207            &self,
208            collection_view: &UICollectionView,
209            source_index_path: &NSIndexPath,
210            destination_index_path: &NSIndexPath,
211        );
212
213        #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
214        /// Returns a list of index titles to display in the index view (e.g. ["A", "B", "C" ... "Z", "#"])
215        #[optional]
216        #[unsafe(method(indexTitlesForCollectionView:))]
217        #[unsafe(method_family = none)]
218        unsafe fn indexTitlesForCollectionView(
219            &self,
220            collection_view: &UICollectionView,
221        ) -> Option<Retained<NSArray<NSString>>>;
222
223        #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
224        /// Returns the index path that corresponds to the given title / index. (e.g. "B",1)
225        /// Return an index path with a single index to indicate an entire section, instead of a specific item.
226        #[optional]
227        #[unsafe(method(collectionView:indexPathForIndexTitle:atIndex:))]
228        #[unsafe(method_family = none)]
229        unsafe fn collectionView_indexPathForIndexTitle_atIndex(
230            &self,
231            collection_view: &UICollectionView,
232            title: &NSString,
233            index: NSInteger,
234        ) -> Retained<NSIndexPath>;
235    }
236);
237
238extern_protocol!(
239    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdatasourceprefetching?language=objc)
240    pub unsafe trait UICollectionViewDataSourcePrefetching:
241        NSObjectProtocol + MainThreadOnly
242    {
243        #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
244        #[unsafe(method(collectionView:prefetchItemsAtIndexPaths:))]
245        #[unsafe(method_family = none)]
246        unsafe fn collectionView_prefetchItemsAtIndexPaths(
247            &self,
248            collection_view: &UICollectionView,
249            index_paths: &NSArray<NSIndexPath>,
250        );
251
252        #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
253        #[optional]
254        #[unsafe(method(collectionView:cancelPrefetchingForItemsAtIndexPaths:))]
255        #[unsafe(method_family = none)]
256        unsafe fn collectionView_cancelPrefetchingForItemsAtIndexPaths(
257            &self,
258            collection_view: &UICollectionView,
259            index_paths: &NSArray<NSIndexPath>,
260        );
261    }
262);
263
264extern_protocol!(
265    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdelegate?language=objc)
266    #[cfg(feature = "UIScrollView")]
267    pub unsafe trait UICollectionViewDelegate:
268        UIScrollViewDelegate + MainThreadOnly
269    {
270        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
271        #[optional]
272        #[unsafe(method(collectionView:shouldHighlightItemAtIndexPath:))]
273        #[unsafe(method_family = none)]
274        unsafe fn collectionView_shouldHighlightItemAtIndexPath(
275            &self,
276            collection_view: &UICollectionView,
277            index_path: &NSIndexPath,
278        ) -> bool;
279
280        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
281        #[optional]
282        #[unsafe(method(collectionView:didHighlightItemAtIndexPath:))]
283        #[unsafe(method_family = none)]
284        unsafe fn collectionView_didHighlightItemAtIndexPath(
285            &self,
286            collection_view: &UICollectionView,
287            index_path: &NSIndexPath,
288        );
289
290        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
291        #[optional]
292        #[unsafe(method(collectionView:didUnhighlightItemAtIndexPath:))]
293        #[unsafe(method_family = none)]
294        unsafe fn collectionView_didUnhighlightItemAtIndexPath(
295            &self,
296            collection_view: &UICollectionView,
297            index_path: &NSIndexPath,
298        );
299
300        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
301        #[optional]
302        #[unsafe(method(collectionView:shouldSelectItemAtIndexPath:))]
303        #[unsafe(method_family = none)]
304        unsafe fn collectionView_shouldSelectItemAtIndexPath(
305            &self,
306            collection_view: &UICollectionView,
307            index_path: &NSIndexPath,
308        ) -> bool;
309
310        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
311        #[optional]
312        #[unsafe(method(collectionView:shouldDeselectItemAtIndexPath:))]
313        #[unsafe(method_family = none)]
314        unsafe fn collectionView_shouldDeselectItemAtIndexPath(
315            &self,
316            collection_view: &UICollectionView,
317            index_path: &NSIndexPath,
318        ) -> bool;
319
320        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
321        #[optional]
322        #[unsafe(method(collectionView:didSelectItemAtIndexPath:))]
323        #[unsafe(method_family = none)]
324        unsafe fn collectionView_didSelectItemAtIndexPath(
325            &self,
326            collection_view: &UICollectionView,
327            index_path: &NSIndexPath,
328        );
329
330        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
331        #[optional]
332        #[unsafe(method(collectionView:didDeselectItemAtIndexPath:))]
333        #[unsafe(method_family = none)]
334        unsafe fn collectionView_didDeselectItemAtIndexPath(
335            &self,
336            collection_view: &UICollectionView,
337            index_path: &NSIndexPath,
338        );
339
340        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
341        /// Called to determine if a primary action can be performed for the item at the given indexPath.
342        /// See
343        /// `collectionView:performPrimaryActionForItemAtIndexPath:`for more details about primary actions.
344        ///
345        ///
346        /// Parameter `collectionView`: This UICollectionView
347        ///
348        /// Parameter `indexPath`: NSIndexPath of the item
349        ///
350        ///
351        /// Returns: `YES` if the primary action can be performed; otherwise `NO`. If not implemented, defaults to `YES` when not editing
352        /// and `NO` when editing.
353        #[optional]
354        #[unsafe(method(collectionView:canPerformPrimaryActionForItemAtIndexPath:))]
355        #[unsafe(method_family = none)]
356        unsafe fn collectionView_canPerformPrimaryActionForItemAtIndexPath(
357            &self,
358            collection_view: &UICollectionView,
359            index_path: &NSIndexPath,
360        ) -> bool;
361
362        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
363        /// Called when the primary action should be performed for the item at the given indexPath.
364        ///
365        ///
366        /// Primary actions allow you to distinguish between a change of selection (which can be based on focus changes or
367        /// other indirect selection changes) and distinct user actions. Primary actions are performed when the user selects a cell without extending
368        /// an existing selection. This is called after
369        /// `shouldSelectItem`and
370        /// `didSelectItem`, regardless of whether the cell's selection
371        /// state was allowed to change.
372        ///
373        /// As an example, use
374        /// `didSelectItemAtIndexPath`for updating state in the current view controller (i.e. buttons, title, etc) and
375        /// use the primary action for navigation or showing another split view column.
376        ///
377        ///
378        /// Parameter `collectionView`: This UICollectionView
379        ///
380        /// Parameter `indexPath`: NSIndexPath of the item to perform the action on
381        #[optional]
382        #[unsafe(method(collectionView:performPrimaryActionForItemAtIndexPath:))]
383        #[unsafe(method_family = none)]
384        unsafe fn collectionView_performPrimaryActionForItemAtIndexPath(
385            &self,
386            collection_view: &UICollectionView,
387            index_path: &NSIndexPath,
388        );
389
390        #[cfg(all(
391            feature = "UICollectionViewCell",
392            feature = "UIResponder",
393            feature = "UIView"
394        ))]
395        #[optional]
396        #[unsafe(method(collectionView:willDisplayCell:forItemAtIndexPath:))]
397        #[unsafe(method_family = none)]
398        unsafe fn collectionView_willDisplayCell_forItemAtIndexPath(
399            &self,
400            collection_view: &UICollectionView,
401            cell: &UICollectionViewCell,
402            index_path: &NSIndexPath,
403        );
404
405        #[cfg(all(
406            feature = "UICollectionViewCell",
407            feature = "UIResponder",
408            feature = "UIView"
409        ))]
410        #[optional]
411        #[unsafe(method(collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:))]
412        #[unsafe(method_family = none)]
413        unsafe fn collectionView_willDisplaySupplementaryView_forElementKind_atIndexPath(
414            &self,
415            collection_view: &UICollectionView,
416            view: &UICollectionReusableView,
417            element_kind: &NSString,
418            index_path: &NSIndexPath,
419        );
420
421        #[cfg(all(
422            feature = "UICollectionViewCell",
423            feature = "UIResponder",
424            feature = "UIView"
425        ))]
426        #[optional]
427        #[unsafe(method(collectionView:didEndDisplayingCell:forItemAtIndexPath:))]
428        #[unsafe(method_family = none)]
429        unsafe fn collectionView_didEndDisplayingCell_forItemAtIndexPath(
430            &self,
431            collection_view: &UICollectionView,
432            cell: &UICollectionViewCell,
433            index_path: &NSIndexPath,
434        );
435
436        #[cfg(all(
437            feature = "UICollectionViewCell",
438            feature = "UIResponder",
439            feature = "UIView"
440        ))]
441        #[optional]
442        #[unsafe(method(collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:))]
443        #[unsafe(method_family = none)]
444        unsafe fn collectionView_didEndDisplayingSupplementaryView_forElementOfKind_atIndexPath(
445            &self,
446            collection_view: &UICollectionView,
447            view: &UICollectionReusableView,
448            element_kind: &NSString,
449            index_path: &NSIndexPath,
450        );
451
452        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
453        #[deprecated]
454        #[optional]
455        #[unsafe(method(collectionView:shouldShowMenuForItemAtIndexPath:))]
456        #[unsafe(method_family = none)]
457        unsafe fn collectionView_shouldShowMenuForItemAtIndexPath(
458            &self,
459            collection_view: &UICollectionView,
460            index_path: &NSIndexPath,
461        ) -> bool;
462
463        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
464        #[deprecated]
465        #[optional]
466        #[unsafe(method(collectionView:canPerformAction:forItemAtIndexPath:withSender:))]
467        #[unsafe(method_family = none)]
468        unsafe fn collectionView_canPerformAction_forItemAtIndexPath_withSender(
469            &self,
470            collection_view: &UICollectionView,
471            action: Sel,
472            index_path: &NSIndexPath,
473            sender: Option<&AnyObject>,
474        ) -> bool;
475
476        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
477        #[deprecated]
478        #[optional]
479        #[unsafe(method(collectionView:performAction:forItemAtIndexPath:withSender:))]
480        #[unsafe(method_family = none)]
481        unsafe fn collectionView_performAction_forItemAtIndexPath_withSender(
482            &self,
483            collection_view: &UICollectionView,
484            action: Sel,
485            index_path: &NSIndexPath,
486            sender: Option<&AnyObject>,
487        );
488
489        #[cfg(all(
490            feature = "UICollectionViewLayout",
491            feature = "UICollectionViewTransitionLayout",
492            feature = "UIResponder",
493            feature = "UIView"
494        ))]
495        #[optional]
496        #[unsafe(method(collectionView:transitionLayoutForOldLayout:newLayout:))]
497        #[unsafe(method_family = none)]
498        unsafe fn collectionView_transitionLayoutForOldLayout_newLayout(
499            &self,
500            collection_view: &UICollectionView,
501            from_layout: &UICollectionViewLayout,
502            to_layout: &UICollectionViewLayout,
503        ) -> Retained<UICollectionViewTransitionLayout>;
504
505        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
506        #[optional]
507        #[unsafe(method(collectionView:canFocusItemAtIndexPath:))]
508        #[unsafe(method_family = none)]
509        unsafe fn collectionView_canFocusItemAtIndexPath(
510            &self,
511            collection_view: &UICollectionView,
512            index_path: &NSIndexPath,
513        ) -> bool;
514
515        #[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
516        #[optional]
517        #[unsafe(method(collectionView:shouldUpdateFocusInContext:))]
518        #[unsafe(method_family = none)]
519        unsafe fn collectionView_shouldUpdateFocusInContext(
520            &self,
521            collection_view: &UICollectionView,
522            context: &UICollectionViewFocusUpdateContext,
523        ) -> bool;
524
525        #[cfg(all(
526            feature = "UIFocus",
527            feature = "UIFocusAnimationCoordinator",
528            feature = "UIResponder",
529            feature = "UIView"
530        ))]
531        #[optional]
532        #[unsafe(method(collectionView:didUpdateFocusInContext:withAnimationCoordinator:))]
533        #[unsafe(method_family = none)]
534        unsafe fn collectionView_didUpdateFocusInContext_withAnimationCoordinator(
535            &self,
536            collection_view: &UICollectionView,
537            context: &UICollectionViewFocusUpdateContext,
538            coordinator: &UIFocusAnimationCoordinator,
539        );
540
541        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
542        #[optional]
543        #[unsafe(method(indexPathForPreferredFocusedViewInCollectionView:))]
544        #[unsafe(method_family = none)]
545        unsafe fn indexPathForPreferredFocusedViewInCollectionView(
546            &self,
547            collection_view: &UICollectionView,
548        ) -> Option<Retained<NSIndexPath>>;
549
550        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
551        /// Determines if the item at the specified index path should also become selected when focus moves to it.
552        /// If the collection view's global selectionFollowsFocus is enabled, this method will allow you to override that behavior on a per-index path basis. This method is not called if selectionFollowsFocus is disabled.
553        #[optional]
554        #[unsafe(method(collectionView:selectionFollowsFocusForItemAtIndexPath:))]
555        #[unsafe(method_family = none)]
556        unsafe fn collectionView_selectionFollowsFocusForItemAtIndexPath(
557            &self,
558            collection_view: &UICollectionView,
559            index_path: &NSIndexPath,
560        ) -> bool;
561
562        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
563        #[optional]
564        #[unsafe(method(collectionView:targetIndexPathForMoveOfItemFromOriginalIndexPath:atCurrentIndexPath:toProposedIndexPath:))]
565        #[unsafe(method_family = none)]
566        unsafe fn collectionView_targetIndexPathForMoveOfItemFromOriginalIndexPath_atCurrentIndexPath_toProposedIndexPath(
567            &self,
568            collection_view: &UICollectionView,
569            original_index_path: &NSIndexPath,
570            current_index_path: &NSIndexPath,
571            proposed_index_path: &NSIndexPath,
572        ) -> Retained<NSIndexPath>;
573
574        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
575        #[deprecated]
576        #[optional]
577        #[unsafe(method(collectionView:targetIndexPathForMoveFromItemAtIndexPath:toProposedIndexPath:))]
578        #[unsafe(method_family = none)]
579        unsafe fn collectionView_targetIndexPathForMoveFromItemAtIndexPath_toProposedIndexPath(
580            &self,
581            collection_view: &UICollectionView,
582            current_index_path: &NSIndexPath,
583            proposed_index_path: &NSIndexPath,
584        ) -> Retained<NSIndexPath>;
585
586        #[cfg(all(
587            feature = "UIResponder",
588            feature = "UIView",
589            feature = "objc2-core-foundation"
590        ))]
591        #[optional]
592        #[unsafe(method(collectionView:targetContentOffsetForProposedContentOffset:))]
593        #[unsafe(method_family = none)]
594        unsafe fn collectionView_targetContentOffsetForProposedContentOffset(
595            &self,
596            collection_view: &UICollectionView,
597            proposed_content_offset: CGPoint,
598        ) -> CGPoint;
599
600        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
601        #[optional]
602        #[unsafe(method(collectionView:canEditItemAtIndexPath:))]
603        #[unsafe(method_family = none)]
604        unsafe fn collectionView_canEditItemAtIndexPath(
605            &self,
606            collection_view: &UICollectionView,
607            index_path: &NSIndexPath,
608        ) -> bool;
609
610        #[cfg(all(
611            feature = "UIResponder",
612            feature = "UISpringLoadedInteraction",
613            feature = "UIView"
614        ))]
615        #[optional]
616        #[unsafe(method(collectionView:shouldSpringLoadItemAtIndexPath:withContext:))]
617        #[unsafe(method_family = none)]
618        unsafe fn collectionView_shouldSpringLoadItemAtIndexPath_withContext(
619            &self,
620            collection_view: &UICollectionView,
621            index_path: &NSIndexPath,
622            context: &ProtocolObject<dyn UISpringLoadedInteractionContext>,
623        ) -> bool;
624
625        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
626        #[optional]
627        #[unsafe(method(collectionView:shouldBeginMultipleSelectionInteractionAtIndexPath:))]
628        #[unsafe(method_family = none)]
629        unsafe fn collectionView_shouldBeginMultipleSelectionInteractionAtIndexPath(
630            &self,
631            collection_view: &UICollectionView,
632            index_path: &NSIndexPath,
633        ) -> bool;
634
635        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
636        #[optional]
637        #[unsafe(method(collectionView:didBeginMultipleSelectionInteractionAtIndexPath:))]
638        #[unsafe(method_family = none)]
639        unsafe fn collectionView_didBeginMultipleSelectionInteractionAtIndexPath(
640            &self,
641            collection_view: &UICollectionView,
642            index_path: &NSIndexPath,
643        );
644
645        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
646        #[optional]
647        #[unsafe(method(collectionViewDidEndMultipleSelectionInteraction:))]
648        #[unsafe(method_family = none)]
649        unsafe fn collectionViewDidEndMultipleSelectionInteraction(
650            &self,
651            collection_view: &UICollectionView,
652        );
653
654        #[cfg(all(
655            feature = "UIContextMenuConfiguration",
656            feature = "UIResponder",
657            feature = "UIView",
658            feature = "objc2-core-foundation"
659        ))]
660        /// Called when a context menu is invoked from this collection view.
661        ///
662        ///
663        /// Parameter `collectionView`: The
664        /// `UICollectionView.`
665        /// Parameter `indexPaths`: An array of index paths on which the menu acts.
666        ///
667        /// Parameter `point`: Touch location in the collection view's coordinate space.
668        ///
669        ///
670        /// Returns: A
671        /// `UIContextMenuConfiguration`describing the menu to be presented. Return nil to prevent the interaction from beginning.
672        /// Returning an empty configuration causes the interaction to begin then fail with a cancellation effect. You might use this
673        /// to indicate to users that it's possible for a menu to be presented from this element, but that there are no actions to
674        /// present at this particular time.
675        ///
676        ///
677        /// The
678        /// `indexPaths`array may contain 0-many items:
679        /// - An empty array indicates that the menu was invoked in the space between cells (or any location that does not map to an item index path).
680        /// - An array with multiple index paths indicates that the menu was invoked on an item within a multiple selection.
681        #[optional]
682        #[unsafe(method(collectionView:contextMenuConfigurationForItemsAtIndexPaths:point:))]
683        #[unsafe(method_family = none)]
684        unsafe fn collectionView_contextMenuConfigurationForItemsAtIndexPaths_point(
685            &self,
686            collection_view: &UICollectionView,
687            index_paths: &NSArray<NSIndexPath>,
688            point: CGPoint,
689        ) -> Option<Retained<UIContextMenuConfiguration>>;
690
691        #[cfg(all(
692            feature = "UIContextMenuConfiguration",
693            feature = "UIResponder",
694            feature = "UITargetedPreview",
695            feature = "UIView"
696        ))]
697        /// Called when a context menu interaction begins in this collection view to request a preview for the interaction's initial highlight effect.
698        /// Return a
699        /// `UITargetedPreview`corresponding to the item at the given indexPath.
700        ///
701        ///
702        /// Parameter `collectionView`: The
703        /// `UICollectionView.`
704        /// Parameter `configuration`: Configuration of the menu that will be presented if the interaction proceeds.
705        ///
706        /// Parameter `indexPath`: Index path of the item at which the interaction is occurring.
707        #[optional]
708        #[unsafe(method(collectionView:contextMenuConfiguration:highlightPreviewForItemAtIndexPath:))]
709        #[unsafe(method_family = none)]
710        unsafe fn collectionView_contextMenuConfiguration_highlightPreviewForItemAtIndexPath(
711            &self,
712            collection_view: &UICollectionView,
713            configuration: &UIContextMenuConfiguration,
714            index_path: &NSIndexPath,
715        ) -> Option<Retained<UITargetedPreview>>;
716
717        #[cfg(all(
718            feature = "UIContextMenuConfiguration",
719            feature = "UIResponder",
720            feature = "UITargetedPreview",
721            feature = "UIView"
722        ))]
723        /// Called when a context menu presented from this collection view is dismissed. Return a
724        /// `UITargetedPreview`corresponding to the item at the given indexPath.
725        ///
726        ///
727        /// Parameter `collectionView`: The
728        /// `UICollectionView.`
729        /// Parameter `configuration`: Configuration of the menu being dismissed.
730        ///
731        /// Parameter `indexPath`: Index path of the item to which the menu is being dismissed.
732        #[optional]
733        #[unsafe(method(collectionView:contextMenuConfiguration:dismissalPreviewForItemAtIndexPath:))]
734        #[unsafe(method_family = none)]
735        unsafe fn collectionView_contextMenuConfiguration_dismissalPreviewForItemAtIndexPath(
736            &self,
737            collection_view: &UICollectionView,
738            configuration: &UIContextMenuConfiguration,
739            index_path: &NSIndexPath,
740        ) -> Option<Retained<UITargetedPreview>>;
741
742        #[cfg(all(
743            feature = "UIContextMenuConfiguration",
744            feature = "UIContextMenuInteraction",
745            feature = "UIResponder",
746            feature = "UIView"
747        ))]
748        /// Called when the interaction is about to "commit" in response to the user tapping the preview.
749        ///
750        ///
751        /// Parameter `collectionView`: The
752        /// `UICollectionView.`
753        /// Parameter `configuration`: Configuration of the currently displayed menu.
754        ///
755        /// Parameter `animator`: Commit animator. Add animations to this object to run them alongside the commit transition.
756        #[optional]
757        #[unsafe(method(collectionView:willPerformPreviewActionForMenuWithConfiguration:animator:))]
758        #[unsafe(method_family = none)]
759        unsafe fn collectionView_willPerformPreviewActionForMenuWithConfiguration_animator(
760            &self,
761            collection_view: &UICollectionView,
762            configuration: &UIContextMenuConfiguration,
763            animator: &ProtocolObject<dyn UIContextMenuInteractionCommitAnimating>,
764        );
765
766        #[cfg(all(
767            feature = "UIContextMenuConfiguration",
768            feature = "UIContextMenuInteraction",
769            feature = "UIResponder",
770            feature = "UIView"
771        ))]
772        /// Called when the collection view is about to display a menu.
773        ///
774        ///
775        /// Parameter `collectionView`: The
776        /// `UICollectionView.`
777        /// Parameter `configuration`: The configuration of the menu about to be displayed.
778        ///
779        /// Parameter `animator`: Appearance animator. Add animations to run them alongside the appearance transition.
780        #[optional]
781        #[unsafe(method(collectionView:willDisplayContextMenuWithConfiguration:animator:))]
782        #[unsafe(method_family = none)]
783        unsafe fn collectionView_willDisplayContextMenuWithConfiguration_animator(
784            &self,
785            collection_view: &UICollectionView,
786            configuration: &UIContextMenuConfiguration,
787            animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
788        );
789
790        #[cfg(all(
791            feature = "UIContextMenuConfiguration",
792            feature = "UIContextMenuInteraction",
793            feature = "UIResponder",
794            feature = "UIView"
795        ))]
796        /// Called when the collection view's context menu interaction is about to end.
797        ///
798        ///
799        /// Parameter `collectionView`: The
800        /// `UICollectionView.`
801        /// Parameter `configuration`: Ending configuration.
802        ///
803        /// Parameter `animator`: Disappearance animator. Add animations to run them alongside the disappearance transition.
804        #[optional]
805        #[unsafe(method(collectionView:willEndContextMenuInteractionWithConfiguration:animator:))]
806        #[unsafe(method_family = none)]
807        unsafe fn collectionView_willEndContextMenuInteractionWithConfiguration_animator(
808            &self,
809            collection_view: &UICollectionView,
810            configuration: &UIContextMenuConfiguration,
811            animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
812        );
813
814        #[cfg(all(
815            feature = "UIResponder",
816            feature = "UIView",
817            feature = "UIWindowSceneActivationConfiguration",
818            feature = "objc2-core-foundation"
819        ))]
820        /// Return a valid
821        /// `UIWindowSceneActivationConfiguration`to allow for the cell to be expanded into a new scene. Return nil to prevent the interaction from starting.
822        ///
823        ///
824        /// Parameter `collectionView`: The collection view
825        ///
826        /// Parameter `indexPath`: The index path of the cell being interacted with
827        ///
828        /// Parameter `point`: The centroid of the interaction in the collection view's coordinate space.
829        #[optional]
830        #[unsafe(method(collectionView:sceneActivationConfigurationForItemAtIndexPath:point:))]
831        #[unsafe(method_family = none)]
832        unsafe fn collectionView_sceneActivationConfigurationForItemAtIndexPath_point(
833            &self,
834            collection_view: &UICollectionView,
835            index_path: &NSIndexPath,
836            point: CGPoint,
837        ) -> Option<Retained<UIWindowSceneActivationConfiguration>>;
838
839        #[cfg(all(
840            feature = "UIContextMenuConfiguration",
841            feature = "UIResponder",
842            feature = "UIView",
843            feature = "objc2-core-foundation"
844        ))]
845        /// Called when the interaction begins.
846        ///
847        ///
848        /// Parameter `collectionView`: The
849        /// `UICollectionView.`
850        /// Parameter `indexPath`: IndexPath of the item for which a configuration is being requested.
851        ///
852        /// Parameter `point`: Touch location in the collection view's coordinate space
853        ///
854        ///
855        /// Returns: A UIContextMenuConfiguration describing the menu to be presented. Return nil to prevent the interaction from beginning.
856        /// Returning an empty configuration causes the interaction to begin then fail with a cancellation effect. You might use this
857        /// to indicate to users that it's possible for a menu to be presented from this element, but that there are no actions to
858        /// present at this particular time. If the non-deprecated replacement for the configuration, highlight preview, or dismissal preview methods is implemented this method is not called.
859        #[deprecated]
860        #[optional]
861        #[unsafe(method(collectionView:contextMenuConfigurationForItemAtIndexPath:point:))]
862        #[unsafe(method_family = none)]
863        unsafe fn collectionView_contextMenuConfigurationForItemAtIndexPath_point(
864            &self,
865            collection_view: &UICollectionView,
866            index_path: &NSIndexPath,
867            point: CGPoint,
868        ) -> Option<Retained<UIContextMenuConfiguration>>;
869
870        #[cfg(all(
871            feature = "UIContextMenuConfiguration",
872            feature = "UIResponder",
873            feature = "UITargetedPreview",
874            feature = "UIView"
875        ))]
876        /// Called when the interaction begins. Return a UITargetedPreview describing the desired highlight preview.
877        /// If the non-deprecated replacement for the configuration, highlight preview, or dismissal preview methods is implemented this method is not called.
878        ///
879        ///
880        /// Parameter `collectionView`: The
881        /// `UICollectionView.`
882        /// Parameter `configuration`: The configuration of the menu about to be displayed by this interaction.
883        #[deprecated]
884        #[optional]
885        #[unsafe(method(collectionView:previewForHighlightingContextMenuWithConfiguration:))]
886        #[unsafe(method_family = none)]
887        unsafe fn collectionView_previewForHighlightingContextMenuWithConfiguration(
888            &self,
889            collection_view: &UICollectionView,
890            configuration: &UIContextMenuConfiguration,
891        ) -> Option<Retained<UITargetedPreview>>;
892
893        #[cfg(all(
894            feature = "UIContextMenuConfiguration",
895            feature = "UIResponder",
896            feature = "UITargetedPreview",
897            feature = "UIView"
898        ))]
899        /// Called when the interaction is about to dismiss. Return a UITargetedPreview describing the desired dismissal target.
900        /// The interaction will animate the presented menu to the target. Use this to customize the dismissal animation.
901        /// If the non-deprecated replacement for the configuration, highlight preview, or dismissal preview methods is implemented this method is not called.
902        ///
903        ///
904        /// Parameter `collectionView`: The
905        /// `UICollectionView.`
906        /// Parameter `configuration`: The configuration of the menu displayed by this interaction.
907        #[deprecated]
908        #[optional]
909        #[unsafe(method(collectionView:previewForDismissingContextMenuWithConfiguration:))]
910        #[unsafe(method_family = none)]
911        unsafe fn collectionView_previewForDismissingContextMenuWithConfiguration(
912            &self,
913            collection_view: &UICollectionView,
914            configuration: &UIContextMenuConfiguration,
915        ) -> Option<Retained<UITargetedPreview>>;
916    }
917);
918
919extern_class!(
920    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionview?language=objc)
921    #[unsafe(super(UIScrollView, UIView, UIResponder, NSObject))]
922    #[thread_kind = MainThreadOnly]
923    #[derive(Debug, PartialEq, Eq, Hash)]
924    #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
925    pub struct UICollectionView;
926);
927
928#[cfg(all(
929    feature = "UIResponder",
930    feature = "UIScrollView",
931    feature = "UIView",
932    feature = "objc2-quartz-core"
933))]
934#[cfg(not(target_os = "watchos"))]
935extern_conformance!(
936    unsafe impl CALayerDelegate for UICollectionView {}
937);
938
939#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
940extern_conformance!(
941    unsafe impl NSCoding for UICollectionView {}
942);
943
944#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
945extern_conformance!(
946    unsafe impl NSObjectProtocol for UICollectionView {}
947);
948
949#[cfg(all(
950    feature = "UIAppearance",
951    feature = "UIResponder",
952    feature = "UIScrollView",
953    feature = "UIView"
954))]
955extern_conformance!(
956    unsafe impl UIAppearance for UICollectionView {}
957);
958
959#[cfg(all(
960    feature = "UIAppearance",
961    feature = "UIResponder",
962    feature = "UIScrollView",
963    feature = "UIView"
964))]
965extern_conformance!(
966    unsafe impl UIAppearanceContainer for UICollectionView {}
967);
968
969#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
970extern_conformance!(
971    unsafe impl UICoordinateSpace for UICollectionView {}
972);
973
974#[cfg(all(
975    feature = "UIDataSourceTranslating",
976    feature = "UIResponder",
977    feature = "UIScrollView",
978    feature = "UIView"
979))]
980extern_conformance!(
981    unsafe impl UIDataSourceTranslating for UICollectionView {}
982);
983
984#[cfg(all(
985    feature = "UIDynamicBehavior",
986    feature = "UIResponder",
987    feature = "UIScrollView",
988    feature = "UIView"
989))]
990extern_conformance!(
991    unsafe impl UIDynamicItem for UICollectionView {}
992);
993
994#[cfg(all(
995    feature = "UIFocus",
996    feature = "UIResponder",
997    feature = "UIScrollView",
998    feature = "UIView"
999))]
1000extern_conformance!(
1001    unsafe impl UIFocusEnvironment for UICollectionView {}
1002);
1003
1004#[cfg(all(
1005    feature = "UIFocus",
1006    feature = "UIResponder",
1007    feature = "UIScrollView",
1008    feature = "UIView"
1009))]
1010extern_conformance!(
1011    unsafe impl UIFocusItem for UICollectionView {}
1012);
1013
1014#[cfg(all(
1015    feature = "UIFocus",
1016    feature = "UIResponder",
1017    feature = "UIScrollView",
1018    feature = "UIView"
1019))]
1020extern_conformance!(
1021    unsafe impl UIFocusItemContainer for UICollectionView {}
1022);
1023
1024#[cfg(all(
1025    feature = "UIFocus",
1026    feature = "UIResponder",
1027    feature = "UIScrollView",
1028    feature = "UIView"
1029))]
1030extern_conformance!(
1031    unsafe impl UIFocusItemScrollableContainer for UICollectionView {}
1032);
1033
1034#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1035extern_conformance!(
1036    unsafe impl UIResponderStandardEditActions for UICollectionView {}
1037);
1038
1039#[cfg(all(
1040    feature = "UIResponder",
1041    feature = "UIScrollView",
1042    feature = "UITraitCollection",
1043    feature = "UIView"
1044))]
1045extern_conformance!(
1046    unsafe impl UITraitEnvironment for UICollectionView {}
1047);
1048
1049#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1050impl UICollectionView {
1051    extern_methods!(
1052        #[cfg(all(feature = "UICollectionViewLayout", feature = "objc2-core-foundation"))]
1053        #[unsafe(method(initWithFrame:collectionViewLayout:))]
1054        #[unsafe(method_family = init)]
1055        pub unsafe fn initWithFrame_collectionViewLayout(
1056            this: Allocated<Self>,
1057            frame: CGRect,
1058            layout: &UICollectionViewLayout,
1059        ) -> Retained<Self>;
1060
1061        #[unsafe(method(initWithCoder:))]
1062        #[unsafe(method_family = init)]
1063        pub unsafe fn initWithCoder(
1064            this: Allocated<Self>,
1065            coder: &NSCoder,
1066        ) -> Option<Retained<Self>>;
1067
1068        #[cfg(feature = "UICollectionViewLayout")]
1069        #[unsafe(method(collectionViewLayout))]
1070        #[unsafe(method_family = none)]
1071        pub unsafe fn collectionViewLayout(&self) -> Retained<UICollectionViewLayout>;
1072
1073        #[cfg(feature = "UICollectionViewLayout")]
1074        /// Setter for [`collectionViewLayout`][Self::collectionViewLayout].
1075        #[unsafe(method(setCollectionViewLayout:))]
1076        #[unsafe(method_family = none)]
1077        pub unsafe fn setCollectionViewLayout(
1078            &self,
1079            collection_view_layout: &UICollectionViewLayout,
1080        );
1081
1082        #[unsafe(method(delegate))]
1083        #[unsafe(method_family = none)]
1084        pub unsafe fn delegate(
1085            &self,
1086        ) -> Option<Retained<ProtocolObject<dyn UICollectionViewDelegate>>>;
1087
1088        /// This is a [weak property][objc2::topics::weak_property].
1089        /// Setter for [`delegate`][Self::delegate].
1090        #[unsafe(method(setDelegate:))]
1091        #[unsafe(method_family = none)]
1092        pub unsafe fn setDelegate(
1093            &self,
1094            delegate: Option<&ProtocolObject<dyn UICollectionViewDelegate>>,
1095        );
1096
1097        #[unsafe(method(dataSource))]
1098        #[unsafe(method_family = none)]
1099        pub unsafe fn dataSource(
1100            &self,
1101        ) -> Option<Retained<ProtocolObject<dyn UICollectionViewDataSource>>>;
1102
1103        /// This is a [weak property][objc2::topics::weak_property].
1104        /// Setter for [`dataSource`][Self::dataSource].
1105        #[unsafe(method(setDataSource:))]
1106        #[unsafe(method_family = none)]
1107        pub unsafe fn setDataSource(
1108            &self,
1109            data_source: Option<&ProtocolObject<dyn UICollectionViewDataSource>>,
1110        );
1111
1112        #[unsafe(method(prefetchDataSource))]
1113        #[unsafe(method_family = none)]
1114        pub unsafe fn prefetchDataSource(
1115            &self,
1116        ) -> Option<Retained<ProtocolObject<dyn UICollectionViewDataSourcePrefetching>>>;
1117
1118        /// This is a [weak property][objc2::topics::weak_property].
1119        /// Setter for [`prefetchDataSource`][Self::prefetchDataSource].
1120        #[unsafe(method(setPrefetchDataSource:))]
1121        #[unsafe(method_family = none)]
1122        pub unsafe fn setPrefetchDataSource(
1123            &self,
1124            prefetch_data_source: Option<
1125                &ProtocolObject<dyn UICollectionViewDataSourcePrefetching>,
1126            >,
1127        );
1128
1129        #[unsafe(method(isPrefetchingEnabled))]
1130        #[unsafe(method_family = none)]
1131        pub unsafe fn isPrefetchingEnabled(&self) -> bool;
1132
1133        /// Setter for [`isPrefetchingEnabled`][Self::isPrefetchingEnabled].
1134        #[unsafe(method(setPrefetchingEnabled:))]
1135        #[unsafe(method_family = none)]
1136        pub unsafe fn setPrefetchingEnabled(&self, prefetching_enabled: bool);
1137
1138        #[unsafe(method(dragDelegate))]
1139        #[unsafe(method_family = none)]
1140        pub unsafe fn dragDelegate(
1141            &self,
1142        ) -> Option<Retained<ProtocolObject<dyn UICollectionViewDragDelegate>>>;
1143
1144        /// This is a [weak property][objc2::topics::weak_property].
1145        /// Setter for [`dragDelegate`][Self::dragDelegate].
1146        #[unsafe(method(setDragDelegate:))]
1147        #[unsafe(method_family = none)]
1148        pub unsafe fn setDragDelegate(
1149            &self,
1150            drag_delegate: Option<&ProtocolObject<dyn UICollectionViewDragDelegate>>,
1151        );
1152
1153        #[unsafe(method(dropDelegate))]
1154        #[unsafe(method_family = none)]
1155        pub unsafe fn dropDelegate(
1156            &self,
1157        ) -> Option<Retained<ProtocolObject<dyn UICollectionViewDropDelegate>>>;
1158
1159        /// This is a [weak property][objc2::topics::weak_property].
1160        /// Setter for [`dropDelegate`][Self::dropDelegate].
1161        #[unsafe(method(setDropDelegate:))]
1162        #[unsafe(method_family = none)]
1163        pub unsafe fn setDropDelegate(
1164            &self,
1165            drop_delegate: Option<&ProtocolObject<dyn UICollectionViewDropDelegate>>,
1166        );
1167
1168        #[unsafe(method(dragInteractionEnabled))]
1169        #[unsafe(method_family = none)]
1170        pub unsafe fn dragInteractionEnabled(&self) -> bool;
1171
1172        /// Setter for [`dragInteractionEnabled`][Self::dragInteractionEnabled].
1173        #[unsafe(method(setDragInteractionEnabled:))]
1174        #[unsafe(method_family = none)]
1175        pub unsafe fn setDragInteractionEnabled(&self, drag_interaction_enabled: bool);
1176
1177        #[cfg(feature = "UIContextMenuInteraction")]
1178        #[unsafe(method(contextMenuInteraction))]
1179        #[unsafe(method_family = none)]
1180        pub unsafe fn contextMenuInteraction(&self) -> Option<Retained<UIContextMenuInteraction>>;
1181
1182        #[unsafe(method(reorderingCadence))]
1183        #[unsafe(method_family = none)]
1184        pub unsafe fn reorderingCadence(&self) -> UICollectionViewReorderingCadence;
1185
1186        /// Setter for [`reorderingCadence`][Self::reorderingCadence].
1187        #[unsafe(method(setReorderingCadence:))]
1188        #[unsafe(method_family = none)]
1189        pub unsafe fn setReorderingCadence(
1190            &self,
1191            reordering_cadence: UICollectionViewReorderingCadence,
1192        );
1193
1194        #[unsafe(method(selfSizingInvalidation))]
1195        #[unsafe(method_family = none)]
1196        pub unsafe fn selfSizingInvalidation(&self) -> UICollectionViewSelfSizingInvalidation;
1197
1198        /// Setter for [`selfSizingInvalidation`][Self::selfSizingInvalidation].
1199        #[unsafe(method(setSelfSizingInvalidation:))]
1200        #[unsafe(method_family = none)]
1201        pub unsafe fn setSelfSizingInvalidation(
1202            &self,
1203            self_sizing_invalidation: UICollectionViewSelfSizingInvalidation,
1204        );
1205
1206        #[unsafe(method(backgroundView))]
1207        #[unsafe(method_family = none)]
1208        pub unsafe fn backgroundView(&self) -> Option<Retained<UIView>>;
1209
1210        /// Setter for [`backgroundView`][Self::backgroundView].
1211        #[unsafe(method(setBackgroundView:))]
1212        #[unsafe(method_family = none)]
1213        pub unsafe fn setBackgroundView(&self, background_view: Option<&UIView>);
1214
1215        #[unsafe(method(registerClass:forCellWithReuseIdentifier:))]
1216        #[unsafe(method_family = none)]
1217        pub unsafe fn registerClass_forCellWithReuseIdentifier(
1218            &self,
1219            cell_class: Option<&AnyClass>,
1220            identifier: &NSString,
1221        );
1222
1223        #[cfg(feature = "UINib")]
1224        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
1225        #[unsafe(method(registerNib:forCellWithReuseIdentifier:))]
1226        #[unsafe(method_family = none)]
1227        pub unsafe fn registerNib_forCellWithReuseIdentifier(
1228            &self,
1229            nib: Option<&UINib>,
1230            identifier: &NSString,
1231        );
1232
1233        #[unsafe(method(registerClass:forSupplementaryViewOfKind:withReuseIdentifier:))]
1234        #[unsafe(method_family = none)]
1235        pub unsafe fn registerClass_forSupplementaryViewOfKind_withReuseIdentifier(
1236            &self,
1237            view_class: Option<&AnyClass>,
1238            element_kind: &NSString,
1239            identifier: &NSString,
1240        );
1241
1242        #[cfg(feature = "UINib")]
1243        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
1244        #[unsafe(method(registerNib:forSupplementaryViewOfKind:withReuseIdentifier:))]
1245        #[unsafe(method_family = none)]
1246        pub unsafe fn registerNib_forSupplementaryViewOfKind_withReuseIdentifier(
1247            &self,
1248            nib: Option<&UINib>,
1249            kind: &NSString,
1250            identifier: &NSString,
1251        );
1252
1253        #[cfg(feature = "UICollectionViewCell")]
1254        #[unsafe(method(dequeueReusableCellWithReuseIdentifier:forIndexPath:))]
1255        #[unsafe(method_family = none)]
1256        pub unsafe fn dequeueReusableCellWithReuseIdentifier_forIndexPath(
1257            &self,
1258            identifier: &NSString,
1259            index_path: &NSIndexPath,
1260        ) -> Retained<UICollectionViewCell>;
1261
1262        #[cfg(feature = "UICollectionViewCell")]
1263        #[unsafe(method(dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath:))]
1264        #[unsafe(method_family = none)]
1265        pub unsafe fn dequeueReusableSupplementaryViewOfKind_withReuseIdentifier_forIndexPath(
1266            &self,
1267            element_kind: &NSString,
1268            identifier: &NSString,
1269            index_path: &NSIndexPath,
1270        ) -> Retained<UICollectionReusableView>;
1271
1272        #[cfg(all(
1273            feature = "UICollectionViewCell",
1274            feature = "UICollectionViewItemRegistration"
1275        ))]
1276        #[unsafe(method(dequeueConfiguredReusableCellWithRegistration:forIndexPath:item:))]
1277        #[unsafe(method_family = none)]
1278        pub unsafe fn dequeueConfiguredReusableCellWithRegistration_forIndexPath_item(
1279            &self,
1280            registration: &UICollectionViewCellRegistration,
1281            index_path: &NSIndexPath,
1282            item: &AnyObject,
1283        ) -> Retained<UICollectionViewCell>;
1284
1285        #[cfg(all(
1286            feature = "UICollectionViewCell",
1287            feature = "UICollectionViewItemRegistration"
1288        ))]
1289        #[unsafe(method(dequeueConfiguredReusableSupplementaryViewWithRegistration:forIndexPath:))]
1290        #[unsafe(method_family = none)]
1291        pub unsafe fn dequeueConfiguredReusableSupplementaryViewWithRegistration_forIndexPath(
1292            &self,
1293            registration: &UICollectionViewSupplementaryRegistration,
1294            index_path: &NSIndexPath,
1295        ) -> Retained<UICollectionReusableView>;
1296
1297        #[unsafe(method(allowsSelection))]
1298        #[unsafe(method_family = none)]
1299        pub unsafe fn allowsSelection(&self) -> bool;
1300
1301        /// Setter for [`allowsSelection`][Self::allowsSelection].
1302        #[unsafe(method(setAllowsSelection:))]
1303        #[unsafe(method_family = none)]
1304        pub unsafe fn setAllowsSelection(&self, allows_selection: bool);
1305
1306        #[unsafe(method(allowsMultipleSelection))]
1307        #[unsafe(method_family = none)]
1308        pub unsafe fn allowsMultipleSelection(&self) -> bool;
1309
1310        /// Setter for [`allowsMultipleSelection`][Self::allowsMultipleSelection].
1311        #[unsafe(method(setAllowsMultipleSelection:))]
1312        #[unsafe(method_family = none)]
1313        pub unsafe fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
1314
1315        #[unsafe(method(indexPathsForSelectedItems))]
1316        #[unsafe(method_family = none)]
1317        pub unsafe fn indexPathsForSelectedItems(&self) -> Option<Retained<NSArray<NSIndexPath>>>;
1318
1319        #[unsafe(method(selectItemAtIndexPath:animated:scrollPosition:))]
1320        #[unsafe(method_family = none)]
1321        pub unsafe fn selectItemAtIndexPath_animated_scrollPosition(
1322            &self,
1323            index_path: Option<&NSIndexPath>,
1324            animated: bool,
1325            scroll_position: UICollectionViewScrollPosition,
1326        );
1327
1328        #[unsafe(method(deselectItemAtIndexPath:animated:))]
1329        #[unsafe(method_family = none)]
1330        pub unsafe fn deselectItemAtIndexPath_animated(
1331            &self,
1332            index_path: &NSIndexPath,
1333            animated: bool,
1334        );
1335
1336        #[unsafe(method(hasUncommittedUpdates))]
1337        #[unsafe(method_family = none)]
1338        pub unsafe fn hasUncommittedUpdates(&self) -> bool;
1339
1340        #[unsafe(method(reloadData))]
1341        #[unsafe(method_family = none)]
1342        pub unsafe fn reloadData(&self);
1343
1344        #[cfg(feature = "UICollectionViewLayout")]
1345        #[unsafe(method(setCollectionViewLayout:animated:))]
1346        #[unsafe(method_family = none)]
1347        pub unsafe fn setCollectionViewLayout_animated(
1348            &self,
1349            layout: &UICollectionViewLayout,
1350            animated: bool,
1351        );
1352
1353        #[cfg(all(feature = "UICollectionViewLayout", feature = "block2"))]
1354        #[unsafe(method(setCollectionViewLayout:animated:completion:))]
1355        #[unsafe(method_family = none)]
1356        pub unsafe fn setCollectionViewLayout_animated_completion(
1357            &self,
1358            layout: &UICollectionViewLayout,
1359            animated: bool,
1360            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
1361        );
1362
1363        #[cfg(all(
1364            feature = "UICollectionViewLayout",
1365            feature = "UICollectionViewTransitionLayout",
1366            feature = "block2"
1367        ))]
1368        #[unsafe(method(startInteractiveTransitionToCollectionViewLayout:completion:))]
1369        #[unsafe(method_family = none)]
1370        pub unsafe fn startInteractiveTransitionToCollectionViewLayout_completion(
1371            &self,
1372            layout: &UICollectionViewLayout,
1373            completion: UICollectionViewLayoutInteractiveTransitionCompletion,
1374        ) -> Retained<UICollectionViewTransitionLayout>;
1375
1376        #[unsafe(method(finishInteractiveTransition))]
1377        #[unsafe(method_family = none)]
1378        pub unsafe fn finishInteractiveTransition(&self);
1379
1380        #[unsafe(method(cancelInteractiveTransition))]
1381        #[unsafe(method_family = none)]
1382        pub unsafe fn cancelInteractiveTransition(&self);
1383
1384        #[unsafe(method(numberOfSections))]
1385        #[unsafe(method_family = none)]
1386        pub unsafe fn numberOfSections(&self) -> NSInteger;
1387
1388        #[unsafe(method(numberOfItemsInSection:))]
1389        #[unsafe(method_family = none)]
1390        pub unsafe fn numberOfItemsInSection(&self, section: NSInteger) -> NSInteger;
1391
1392        #[cfg(feature = "UICollectionViewLayout")]
1393        #[unsafe(method(layoutAttributesForItemAtIndexPath:))]
1394        #[unsafe(method_family = none)]
1395        pub unsafe fn layoutAttributesForItemAtIndexPath(
1396            &self,
1397            index_path: &NSIndexPath,
1398        ) -> Option<Retained<UICollectionViewLayoutAttributes>>;
1399
1400        #[cfg(feature = "UICollectionViewLayout")]
1401        #[unsafe(method(layoutAttributesForSupplementaryElementOfKind:atIndexPath:))]
1402        #[unsafe(method_family = none)]
1403        pub unsafe fn layoutAttributesForSupplementaryElementOfKind_atIndexPath(
1404            &self,
1405            kind: &NSString,
1406            index_path: &NSIndexPath,
1407        ) -> Option<Retained<UICollectionViewLayoutAttributes>>;
1408
1409        #[cfg(feature = "objc2-core-foundation")]
1410        #[unsafe(method(indexPathForItemAtPoint:))]
1411        #[unsafe(method_family = none)]
1412        pub unsafe fn indexPathForItemAtPoint(
1413            &self,
1414            point: CGPoint,
1415        ) -> Option<Retained<NSIndexPath>>;
1416
1417        #[cfg(feature = "UICollectionViewCell")]
1418        #[unsafe(method(indexPathForCell:))]
1419        #[unsafe(method_family = none)]
1420        pub unsafe fn indexPathForCell(
1421            &self,
1422            cell: &UICollectionViewCell,
1423        ) -> Option<Retained<NSIndexPath>>;
1424
1425        #[cfg(feature = "UICollectionViewCell")]
1426        /// Gets the index path of the specified supplementary view.
1427        ///
1428        /// Parameter `supplementaryView`: The supplementary or decoration view whose index path you want.
1429        ///
1430        /// Returns: The index path of the specified view if it is in the collection view, else `nil`.
1431        #[unsafe(method(indexPathForSupplementaryView:))]
1432        #[unsafe(method_family = none)]
1433        pub unsafe fn indexPathForSupplementaryView(
1434            &self,
1435            supplementary_view: &UICollectionReusableView,
1436        ) -> Option<Retained<NSIndexPath>>;
1437
1438        #[cfg(feature = "UICollectionViewCell")]
1439        #[unsafe(method(cellForItemAtIndexPath:))]
1440        #[unsafe(method_family = none)]
1441        pub unsafe fn cellForItemAtIndexPath(
1442            &self,
1443            index_path: &NSIndexPath,
1444        ) -> Option<Retained<UICollectionViewCell>>;
1445
1446        #[cfg(feature = "UICollectionViewCell")]
1447        #[unsafe(method(visibleCells))]
1448        #[unsafe(method_family = none)]
1449        pub unsafe fn visibleCells(&self) -> Retained<NSArray<UICollectionViewCell>>;
1450
1451        #[unsafe(method(indexPathsForVisibleItems))]
1452        #[unsafe(method_family = none)]
1453        pub unsafe fn indexPathsForVisibleItems(&self) -> Retained<NSArray<NSIndexPath>>;
1454
1455        #[cfg(feature = "UICollectionViewCell")]
1456        #[unsafe(method(supplementaryViewForElementKind:atIndexPath:))]
1457        #[unsafe(method_family = none)]
1458        pub unsafe fn supplementaryViewForElementKind_atIndexPath(
1459            &self,
1460            element_kind: &NSString,
1461            index_path: &NSIndexPath,
1462        ) -> Option<Retained<UICollectionReusableView>>;
1463
1464        #[cfg(feature = "UICollectionViewCell")]
1465        #[unsafe(method(visibleSupplementaryViewsOfKind:))]
1466        #[unsafe(method_family = none)]
1467        pub unsafe fn visibleSupplementaryViewsOfKind(
1468            &self,
1469            element_kind: &NSString,
1470        ) -> Retained<NSArray<UICollectionReusableView>>;
1471
1472        #[unsafe(method(indexPathsForVisibleSupplementaryElementsOfKind:))]
1473        #[unsafe(method_family = none)]
1474        pub unsafe fn indexPathsForVisibleSupplementaryElementsOfKind(
1475            &self,
1476            element_kind: &NSString,
1477        ) -> Retained<NSArray<NSIndexPath>>;
1478
1479        #[unsafe(method(scrollToItemAtIndexPath:atScrollPosition:animated:))]
1480        #[unsafe(method_family = none)]
1481        pub unsafe fn scrollToItemAtIndexPath_atScrollPosition_animated(
1482            &self,
1483            index_path: &NSIndexPath,
1484            scroll_position: UICollectionViewScrollPosition,
1485            animated: bool,
1486        );
1487
1488        #[unsafe(method(insertSections:))]
1489        #[unsafe(method_family = none)]
1490        pub unsafe fn insertSections(&self, sections: &NSIndexSet);
1491
1492        #[unsafe(method(deleteSections:))]
1493        #[unsafe(method_family = none)]
1494        pub unsafe fn deleteSections(&self, sections: &NSIndexSet);
1495
1496        #[unsafe(method(moveSection:toSection:))]
1497        #[unsafe(method_family = none)]
1498        pub unsafe fn moveSection_toSection(&self, section: NSInteger, new_section: NSInteger);
1499
1500        #[unsafe(method(reloadSections:))]
1501        #[unsafe(method_family = none)]
1502        pub unsafe fn reloadSections(&self, sections: &NSIndexSet);
1503
1504        #[unsafe(method(insertItemsAtIndexPaths:))]
1505        #[unsafe(method_family = none)]
1506        pub unsafe fn insertItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
1507
1508        #[unsafe(method(deleteItemsAtIndexPaths:))]
1509        #[unsafe(method_family = none)]
1510        pub unsafe fn deleteItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
1511
1512        #[unsafe(method(moveItemAtIndexPath:toIndexPath:))]
1513        #[unsafe(method_family = none)]
1514        pub unsafe fn moveItemAtIndexPath_toIndexPath(
1515            &self,
1516            index_path: &NSIndexPath,
1517            new_index_path: &NSIndexPath,
1518        );
1519
1520        #[unsafe(method(reloadItemsAtIndexPaths:))]
1521        #[unsafe(method_family = none)]
1522        pub unsafe fn reloadItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
1523
1524        #[unsafe(method(reconfigureItemsAtIndexPaths:))]
1525        #[unsafe(method_family = none)]
1526        pub unsafe fn reconfigureItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
1527
1528        #[cfg(feature = "block2")]
1529        #[unsafe(method(performBatchUpdates:completion:))]
1530        #[unsafe(method_family = none)]
1531        pub unsafe fn performBatchUpdates_completion(
1532            &self,
1533            updates: Option<&block2::DynBlock<dyn Fn() + '_>>,
1534            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
1535        );
1536
1537        #[unsafe(method(beginInteractiveMovementForItemAtIndexPath:))]
1538        #[unsafe(method_family = none)]
1539        pub unsafe fn beginInteractiveMovementForItemAtIndexPath(
1540            &self,
1541            index_path: &NSIndexPath,
1542        ) -> bool;
1543
1544        #[cfg(feature = "objc2-core-foundation")]
1545        #[unsafe(method(updateInteractiveMovementTargetPosition:))]
1546        #[unsafe(method_family = none)]
1547        pub unsafe fn updateInteractiveMovementTargetPosition(&self, target_position: CGPoint);
1548
1549        #[unsafe(method(endInteractiveMovement))]
1550        #[unsafe(method_family = none)]
1551        pub unsafe fn endInteractiveMovement(&self);
1552
1553        #[unsafe(method(cancelInteractiveMovement))]
1554        #[unsafe(method_family = none)]
1555        pub unsafe fn cancelInteractiveMovement(&self);
1556
1557        #[unsafe(method(remembersLastFocusedIndexPath))]
1558        #[unsafe(method_family = none)]
1559        pub unsafe fn remembersLastFocusedIndexPath(&self) -> bool;
1560
1561        /// Setter for [`remembersLastFocusedIndexPath`][Self::remembersLastFocusedIndexPath].
1562        #[unsafe(method(setRemembersLastFocusedIndexPath:))]
1563        #[unsafe(method_family = none)]
1564        pub unsafe fn setRemembersLastFocusedIndexPath(
1565            &self,
1566            remembers_last_focused_index_path: bool,
1567        );
1568
1569        /// When enabled, the collection view ensures that selection is automatically triggered when focus moves to a cell.
1570        /// Defaults to a system derived value based on platform and other properties of the collection view.
1571        #[unsafe(method(selectionFollowsFocus))]
1572        #[unsafe(method_family = none)]
1573        pub unsafe fn selectionFollowsFocus(&self) -> bool;
1574
1575        /// Setter for [`selectionFollowsFocus`][Self::selectionFollowsFocus].
1576        #[unsafe(method(setSelectionFollowsFocus:))]
1577        #[unsafe(method_family = none)]
1578        pub unsafe fn setSelectionFollowsFocus(&self, selection_follows_focus: bool);
1579
1580        /// Determines if the collection view allows its cells to become focused.
1581        /// When collectionView:canFocusItemAtIndexPath: is implemented, its return value takes precedence over this method.
1582        /// Defaults to a system derived value based on platform and other properties of the collection view.
1583        #[unsafe(method(allowsFocus))]
1584        #[unsafe(method_family = none)]
1585        pub unsafe fn allowsFocus(&self) -> bool;
1586
1587        /// Setter for [`allowsFocus`][Self::allowsFocus].
1588        #[unsafe(method(setAllowsFocus:))]
1589        #[unsafe(method_family = none)]
1590        pub unsafe fn setAllowsFocus(&self, allows_focus: bool);
1591
1592        /// Determines if the collection view allows its cells to become focused while editing.
1593        /// When collectionView:canFocusItemAtIndexPath: is implemented, its return value takes precedence over this method.
1594        /// Defaults to a system derived value based on platform and other properties of the collection view.
1595        #[unsafe(method(allowsFocusDuringEditing))]
1596        #[unsafe(method_family = none)]
1597        pub unsafe fn allowsFocusDuringEditing(&self) -> bool;
1598
1599        /// Setter for [`allowsFocusDuringEditing`][Self::allowsFocusDuringEditing].
1600        #[unsafe(method(setAllowsFocusDuringEditing:))]
1601        #[unsafe(method_family = none)]
1602        pub unsafe fn setAllowsFocusDuringEditing(&self, allows_focus_during_editing: bool);
1603
1604        #[unsafe(method(hasActiveDrag))]
1605        #[unsafe(method_family = none)]
1606        pub unsafe fn hasActiveDrag(&self) -> bool;
1607
1608        #[unsafe(method(hasActiveDrop))]
1609        #[unsafe(method_family = none)]
1610        pub unsafe fn hasActiveDrop(&self) -> bool;
1611
1612        #[unsafe(method(isEditing))]
1613        #[unsafe(method_family = none)]
1614        pub unsafe fn isEditing(&self) -> bool;
1615
1616        /// Setter for [`isEditing`][Self::isEditing].
1617        #[unsafe(method(setEditing:))]
1618        #[unsafe(method_family = none)]
1619        pub unsafe fn setEditing(&self, editing: bool);
1620
1621        #[unsafe(method(allowsSelectionDuringEditing))]
1622        #[unsafe(method_family = none)]
1623        pub unsafe fn allowsSelectionDuringEditing(&self) -> bool;
1624
1625        /// Setter for [`allowsSelectionDuringEditing`][Self::allowsSelectionDuringEditing].
1626        #[unsafe(method(setAllowsSelectionDuringEditing:))]
1627        #[unsafe(method_family = none)]
1628        pub unsafe fn setAllowsSelectionDuringEditing(&self, allows_selection_during_editing: bool);
1629
1630        #[unsafe(method(allowsMultipleSelectionDuringEditing))]
1631        #[unsafe(method_family = none)]
1632        pub unsafe fn allowsMultipleSelectionDuringEditing(&self) -> bool;
1633
1634        /// Setter for [`allowsMultipleSelectionDuringEditing`][Self::allowsMultipleSelectionDuringEditing].
1635        #[unsafe(method(setAllowsMultipleSelectionDuringEditing:))]
1636        #[unsafe(method_family = none)]
1637        pub unsafe fn setAllowsMultipleSelectionDuringEditing(
1638            &self,
1639            allows_multiple_selection_during_editing: bool,
1640        );
1641    );
1642}
1643
1644/// Methods declared on superclass `UIView`.
1645#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1646impl UICollectionView {
1647    extern_methods!(
1648        #[cfg(feature = "objc2-core-foundation")]
1649        #[unsafe(method(initWithFrame:))]
1650        #[unsafe(method_family = init)]
1651        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
1652    );
1653}
1654
1655/// Methods declared on superclass `NSObject`.
1656#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1657impl UICollectionView {
1658    extern_methods!(
1659        #[unsafe(method(init))]
1660        #[unsafe(method_family = init)]
1661        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1662
1663        #[unsafe(method(new))]
1664        #[unsafe(method_family = new)]
1665        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1666    );
1667}
1668
1669/// UIDragAndDrop.
1670#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1671impl UICollectionView {
1672    extern_methods!();
1673}
1674
1675#[cfg(all(
1676    feature = "UIResponder",
1677    feature = "UIScrollView",
1678    feature = "UISpringLoadedInteractionSupporting",
1679    feature = "UIView"
1680))]
1681extern_conformance!(
1682    unsafe impl UISpringLoadedInteractionSupporting for UICollectionView {}
1683);
1684
1685extern_protocol!(
1686    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdragdelegate?language=objc)
1687    pub unsafe trait UICollectionViewDragDelegate:
1688        NSObjectProtocol + MainThreadOnly
1689    {
1690        #[cfg(all(
1691            feature = "UIDragItem",
1692            feature = "UIDragSession",
1693            feature = "UIResponder",
1694            feature = "UIScrollView",
1695            feature = "UIView"
1696        ))]
1697        #[unsafe(method(collectionView:itemsForBeginningDragSession:atIndexPath:))]
1698        #[unsafe(method_family = none)]
1699        unsafe fn collectionView_itemsForBeginningDragSession_atIndexPath(
1700            &self,
1701            collection_view: &UICollectionView,
1702            session: &ProtocolObject<dyn UIDragSession>,
1703            index_path: &NSIndexPath,
1704        ) -> Retained<NSArray<UIDragItem>>;
1705
1706        #[cfg(all(
1707            feature = "UIDragItem",
1708            feature = "UIDragSession",
1709            feature = "UIResponder",
1710            feature = "UIScrollView",
1711            feature = "UIView",
1712            feature = "objc2-core-foundation"
1713        ))]
1714        #[optional]
1715        #[unsafe(method(collectionView:itemsForAddingToDragSession:atIndexPath:point:))]
1716        #[unsafe(method_family = none)]
1717        unsafe fn collectionView_itemsForAddingToDragSession_atIndexPath_point(
1718            &self,
1719            collection_view: &UICollectionView,
1720            session: &ProtocolObject<dyn UIDragSession>,
1721            index_path: &NSIndexPath,
1722            point: CGPoint,
1723        ) -> Retained<NSArray<UIDragItem>>;
1724
1725        #[cfg(all(
1726            feature = "UIDragPreviewParameters",
1727            feature = "UIPreviewParameters",
1728            feature = "UIResponder",
1729            feature = "UIScrollView",
1730            feature = "UIView"
1731        ))]
1732        #[optional]
1733        #[unsafe(method(collectionView:dragPreviewParametersForItemAtIndexPath:))]
1734        #[unsafe(method_family = none)]
1735        unsafe fn collectionView_dragPreviewParametersForItemAtIndexPath(
1736            &self,
1737            collection_view: &UICollectionView,
1738            index_path: &NSIndexPath,
1739        ) -> Option<Retained<UIDragPreviewParameters>>;
1740
1741        #[cfg(all(
1742            feature = "UIDragSession",
1743            feature = "UIResponder",
1744            feature = "UIScrollView",
1745            feature = "UIView"
1746        ))]
1747        #[optional]
1748        #[unsafe(method(collectionView:dragSessionWillBegin:))]
1749        #[unsafe(method_family = none)]
1750        unsafe fn collectionView_dragSessionWillBegin(
1751            &self,
1752            collection_view: &UICollectionView,
1753            session: &ProtocolObject<dyn UIDragSession>,
1754        );
1755
1756        #[cfg(all(
1757            feature = "UIDragSession",
1758            feature = "UIResponder",
1759            feature = "UIScrollView",
1760            feature = "UIView"
1761        ))]
1762        #[optional]
1763        #[unsafe(method(collectionView:dragSessionDidEnd:))]
1764        #[unsafe(method_family = none)]
1765        unsafe fn collectionView_dragSessionDidEnd(
1766            &self,
1767            collection_view: &UICollectionView,
1768            session: &ProtocolObject<dyn UIDragSession>,
1769        );
1770
1771        #[cfg(all(
1772            feature = "UIDragSession",
1773            feature = "UIResponder",
1774            feature = "UIScrollView",
1775            feature = "UIView"
1776        ))]
1777        #[optional]
1778        #[unsafe(method(collectionView:dragSessionAllowsMoveOperation:))]
1779        #[unsafe(method_family = none)]
1780        unsafe fn collectionView_dragSessionAllowsMoveOperation(
1781            &self,
1782            collection_view: &UICollectionView,
1783            session: &ProtocolObject<dyn UIDragSession>,
1784        ) -> bool;
1785
1786        #[cfg(all(
1787            feature = "UIDragSession",
1788            feature = "UIResponder",
1789            feature = "UIScrollView",
1790            feature = "UIView"
1791        ))]
1792        #[optional]
1793        #[unsafe(method(collectionView:dragSessionIsRestrictedToDraggingApplication:))]
1794        #[unsafe(method_family = none)]
1795        unsafe fn collectionView_dragSessionIsRestrictedToDraggingApplication(
1796            &self,
1797            collection_view: &UICollectionView,
1798            session: &ProtocolObject<dyn UIDragSession>,
1799        ) -> bool;
1800    }
1801);
1802
1803extern_protocol!(
1804    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdropdelegate?language=objc)
1805    pub unsafe trait UICollectionViewDropDelegate:
1806        NSObjectProtocol + MainThreadOnly
1807    {
1808        #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1809        #[unsafe(method(collectionView:performDropWithCoordinator:))]
1810        #[unsafe(method_family = none)]
1811        unsafe fn collectionView_performDropWithCoordinator(
1812            &self,
1813            collection_view: &UICollectionView,
1814            coordinator: &ProtocolObject<dyn UICollectionViewDropCoordinator>,
1815        );
1816
1817        #[cfg(all(
1818            feature = "UIDragSession",
1819            feature = "UIResponder",
1820            feature = "UIScrollView",
1821            feature = "UIView"
1822        ))]
1823        #[optional]
1824        #[unsafe(method(collectionView:canHandleDropSession:))]
1825        #[unsafe(method_family = none)]
1826        unsafe fn collectionView_canHandleDropSession(
1827            &self,
1828            collection_view: &UICollectionView,
1829            session: &ProtocolObject<dyn UIDropSession>,
1830        ) -> bool;
1831
1832        #[cfg(all(
1833            feature = "UIDragSession",
1834            feature = "UIResponder",
1835            feature = "UIScrollView",
1836            feature = "UIView"
1837        ))]
1838        #[optional]
1839        #[unsafe(method(collectionView:dropSessionDidEnter:))]
1840        #[unsafe(method_family = none)]
1841        unsafe fn collectionView_dropSessionDidEnter(
1842            &self,
1843            collection_view: &UICollectionView,
1844            session: &ProtocolObject<dyn UIDropSession>,
1845        );
1846
1847        #[cfg(all(
1848            feature = "UIDragSession",
1849            feature = "UIDropInteraction",
1850            feature = "UIResponder",
1851            feature = "UIScrollView",
1852            feature = "UIView"
1853        ))]
1854        #[optional]
1855        #[unsafe(method(collectionView:dropSessionDidUpdate:withDestinationIndexPath:))]
1856        #[unsafe(method_family = none)]
1857        unsafe fn collectionView_dropSessionDidUpdate_withDestinationIndexPath(
1858            &self,
1859            collection_view: &UICollectionView,
1860            session: &ProtocolObject<dyn UIDropSession>,
1861            destination_index_path: Option<&NSIndexPath>,
1862        ) -> Retained<UICollectionViewDropProposal>;
1863
1864        #[cfg(all(
1865            feature = "UIDragSession",
1866            feature = "UIResponder",
1867            feature = "UIScrollView",
1868            feature = "UIView"
1869        ))]
1870        #[optional]
1871        #[unsafe(method(collectionView:dropSessionDidExit:))]
1872        #[unsafe(method_family = none)]
1873        unsafe fn collectionView_dropSessionDidExit(
1874            &self,
1875            collection_view: &UICollectionView,
1876            session: &ProtocolObject<dyn UIDropSession>,
1877        );
1878
1879        #[cfg(all(
1880            feature = "UIDragSession",
1881            feature = "UIResponder",
1882            feature = "UIScrollView",
1883            feature = "UIView"
1884        ))]
1885        #[optional]
1886        #[unsafe(method(collectionView:dropSessionDidEnd:))]
1887        #[unsafe(method_family = none)]
1888        unsafe fn collectionView_dropSessionDidEnd(
1889            &self,
1890            collection_view: &UICollectionView,
1891            session: &ProtocolObject<dyn UIDropSession>,
1892        );
1893
1894        #[cfg(all(
1895            feature = "UIDragPreviewParameters",
1896            feature = "UIPreviewParameters",
1897            feature = "UIResponder",
1898            feature = "UIScrollView",
1899            feature = "UIView"
1900        ))]
1901        #[optional]
1902        #[unsafe(method(collectionView:dropPreviewParametersForItemAtIndexPath:))]
1903        #[unsafe(method_family = none)]
1904        unsafe fn collectionView_dropPreviewParametersForItemAtIndexPath(
1905            &self,
1906            collection_view: &UICollectionView,
1907            index_path: &NSIndexPath,
1908        ) -> Option<Retained<UIDragPreviewParameters>>;
1909    }
1910);
1911
1912/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdropintent?language=objc)
1913// NS_ENUM
1914#[repr(transparent)]
1915#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1916pub struct UICollectionViewDropIntent(pub NSInteger);
1917impl UICollectionViewDropIntent {
1918    #[doc(alias = "UICollectionViewDropIntentUnspecified")]
1919    pub const Unspecified: Self = Self(0);
1920    #[doc(alias = "UICollectionViewDropIntentInsertAtDestinationIndexPath")]
1921    pub const InsertAtDestinationIndexPath: Self = Self(1);
1922    #[doc(alias = "UICollectionViewDropIntentInsertIntoDestinationIndexPath")]
1923    pub const InsertIntoDestinationIndexPath: Self = Self(2);
1924}
1925
1926unsafe impl Encode for UICollectionViewDropIntent {
1927    const ENCODING: Encoding = NSInteger::ENCODING;
1928}
1929
1930unsafe impl RefEncode for UICollectionViewDropIntent {
1931    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1932}
1933
1934extern_class!(
1935    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdropproposal?language=objc)
1936    #[unsafe(super(UIDropProposal, NSObject))]
1937    #[thread_kind = MainThreadOnly]
1938    #[derive(Debug, PartialEq, Eq, Hash)]
1939    #[cfg(feature = "UIDropInteraction")]
1940    pub struct UICollectionViewDropProposal;
1941);
1942
1943#[cfg(feature = "UIDropInteraction")]
1944extern_conformance!(
1945    unsafe impl NSCopying for UICollectionViewDropProposal {}
1946);
1947
1948#[cfg(feature = "UIDropInteraction")]
1949unsafe impl CopyingHelper for UICollectionViewDropProposal {
1950    type Result = Self;
1951}
1952
1953#[cfg(feature = "UIDropInteraction")]
1954extern_conformance!(
1955    unsafe impl NSObjectProtocol for UICollectionViewDropProposal {}
1956);
1957
1958#[cfg(feature = "UIDropInteraction")]
1959impl UICollectionViewDropProposal {
1960    extern_methods!(
1961        #[unsafe(method(initWithDropOperation:intent:))]
1962        #[unsafe(method_family = init)]
1963        pub unsafe fn initWithDropOperation_intent(
1964            this: Allocated<Self>,
1965            operation: UIDropOperation,
1966            intent: UICollectionViewDropIntent,
1967        ) -> Retained<Self>;
1968
1969        #[unsafe(method(intent))]
1970        #[unsafe(method_family = none)]
1971        pub unsafe fn intent(&self) -> UICollectionViewDropIntent;
1972    );
1973}
1974
1975/// Methods declared on superclass `UIDropProposal`.
1976#[cfg(feature = "UIDropInteraction")]
1977impl UICollectionViewDropProposal {
1978    extern_methods!(
1979        #[unsafe(method(initWithDropOperation:))]
1980        #[unsafe(method_family = init)]
1981        pub unsafe fn initWithDropOperation(
1982            this: Allocated<Self>,
1983            operation: UIDropOperation,
1984        ) -> Retained<Self>;
1985
1986        #[unsafe(method(init))]
1987        #[unsafe(method_family = init)]
1988        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1989
1990        #[unsafe(method(new))]
1991        #[unsafe(method_family = new)]
1992        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1993    );
1994}
1995
1996extern_protocol!(
1997    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdropcoordinator?language=objc)
1998    pub unsafe trait UICollectionViewDropCoordinator:
1999        NSObjectProtocol + MainThreadOnly
2000    {
2001        #[unsafe(method(items))]
2002        #[unsafe(method_family = none)]
2003        unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UICollectionViewDropItem>>>;
2004
2005        #[unsafe(method(destinationIndexPath))]
2006        #[unsafe(method_family = none)]
2007        unsafe fn destinationIndexPath(&self) -> Option<Retained<NSIndexPath>>;
2008
2009        #[cfg(feature = "UIDropInteraction")]
2010        #[unsafe(method(proposal))]
2011        #[unsafe(method_family = none)]
2012        unsafe fn proposal(&self) -> Retained<UICollectionViewDropProposal>;
2013
2014        #[cfg(feature = "UIDragSession")]
2015        #[unsafe(method(session))]
2016        #[unsafe(method_family = none)]
2017        unsafe fn session(&self) -> Retained<ProtocolObject<dyn UIDropSession>>;
2018
2019        #[cfg(all(feature = "UIDragInteraction", feature = "UIDragItem"))]
2020        #[unsafe(method(dropItem:toPlaceholder:))]
2021        #[unsafe(method_family = none)]
2022        unsafe fn dropItem_toPlaceholder(
2023            &self,
2024            drag_item: &UIDragItem,
2025            placeholder: &UICollectionViewDropPlaceholder,
2026        ) -> Retained<ProtocolObject<dyn UICollectionViewDropPlaceholderContext>>;
2027
2028        #[cfg(all(feature = "UIDragInteraction", feature = "UIDragItem"))]
2029        #[unsafe(method(dropItem:toItemAtIndexPath:))]
2030        #[unsafe(method_family = none)]
2031        unsafe fn dropItem_toItemAtIndexPath(
2032            &self,
2033            drag_item: &UIDragItem,
2034            index_path: &NSIndexPath,
2035        ) -> Retained<ProtocolObject<dyn UIDragAnimating>>;
2036
2037        #[cfg(all(
2038            feature = "UIDragInteraction",
2039            feature = "UIDragItem",
2040            feature = "objc2-core-foundation"
2041        ))]
2042        #[unsafe(method(dropItem:intoItemAtIndexPath:rect:))]
2043        #[unsafe(method_family = none)]
2044        unsafe fn dropItem_intoItemAtIndexPath_rect(
2045            &self,
2046            drag_item: &UIDragItem,
2047            index_path: &NSIndexPath,
2048            rect: CGRect,
2049        ) -> Retained<ProtocolObject<dyn UIDragAnimating>>;
2050
2051        #[cfg(all(
2052            feature = "UIDragInteraction",
2053            feature = "UIDragItem",
2054            feature = "UITargetedDragPreview",
2055            feature = "UITargetedPreview"
2056        ))]
2057        #[unsafe(method(dropItem:toTarget:))]
2058        #[unsafe(method_family = none)]
2059        unsafe fn dropItem_toTarget(
2060            &self,
2061            drag_item: &UIDragItem,
2062            target: &UIDragPreviewTarget,
2063        ) -> Retained<ProtocolObject<dyn UIDragAnimating>>;
2064    }
2065);
2066
2067extern_class!(
2068    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewplaceholder?language=objc)
2069    #[unsafe(super(NSObject))]
2070    #[thread_kind = MainThreadOnly]
2071    #[derive(Debug, PartialEq, Eq, Hash)]
2072    pub struct UICollectionViewPlaceholder;
2073);
2074
2075extern_conformance!(
2076    unsafe impl NSObjectProtocol for UICollectionViewPlaceholder {}
2077);
2078
2079impl UICollectionViewPlaceholder {
2080    extern_methods!(
2081        #[unsafe(method(initWithInsertionIndexPath:reuseIdentifier:))]
2082        #[unsafe(method_family = init)]
2083        pub unsafe fn initWithInsertionIndexPath_reuseIdentifier(
2084            this: Allocated<Self>,
2085            insertion_index_path: &NSIndexPath,
2086            reuse_identifier: &NSString,
2087        ) -> Retained<Self>;
2088
2089        #[unsafe(method(init))]
2090        #[unsafe(method_family = init)]
2091        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2092
2093        #[unsafe(method(new))]
2094        #[unsafe(method_family = new)]
2095        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
2096
2097        #[cfg(all(
2098            feature = "UICollectionViewCell",
2099            feature = "UIResponder",
2100            feature = "UIView",
2101            feature = "block2"
2102        ))]
2103        #[unsafe(method(cellUpdateHandler))]
2104        #[unsafe(method_family = none)]
2105        pub unsafe fn cellUpdateHandler(
2106            &self,
2107        ) -> *mut block2::DynBlock<dyn Fn(NonNull<UICollectionViewCell>)>;
2108
2109        #[cfg(all(
2110            feature = "UICollectionViewCell",
2111            feature = "UIResponder",
2112            feature = "UIView",
2113            feature = "block2"
2114        ))]
2115        /// Setter for [`cellUpdateHandler`][Self::cellUpdateHandler].
2116        #[unsafe(method(setCellUpdateHandler:))]
2117        #[unsafe(method_family = none)]
2118        pub unsafe fn setCellUpdateHandler(
2119            &self,
2120            cell_update_handler: Option<&block2::DynBlock<dyn Fn(NonNull<UICollectionViewCell>)>>,
2121        );
2122    );
2123}
2124
2125extern_class!(
2126    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdropplaceholder?language=objc)
2127    #[unsafe(super(UICollectionViewPlaceholder, NSObject))]
2128    #[thread_kind = MainThreadOnly]
2129    #[derive(Debug, PartialEq, Eq, Hash)]
2130    pub struct UICollectionViewDropPlaceholder;
2131);
2132
2133extern_conformance!(
2134    unsafe impl NSObjectProtocol for UICollectionViewDropPlaceholder {}
2135);
2136
2137impl UICollectionViewDropPlaceholder {
2138    extern_methods!(
2139        #[cfg(all(
2140            feature = "UICollectionViewCell",
2141            feature = "UIDragPreviewParameters",
2142            feature = "UIPreviewParameters",
2143            feature = "UIResponder",
2144            feature = "UIView",
2145            feature = "block2"
2146        ))]
2147        #[unsafe(method(previewParametersProvider))]
2148        #[unsafe(method_family = none)]
2149        pub unsafe fn previewParametersProvider(
2150            &self,
2151        ) -> *mut block2::DynBlock<
2152            dyn Fn(NonNull<UICollectionViewCell>) -> *mut UIDragPreviewParameters,
2153        >;
2154
2155        #[cfg(all(
2156            feature = "UICollectionViewCell",
2157            feature = "UIDragPreviewParameters",
2158            feature = "UIPreviewParameters",
2159            feature = "UIResponder",
2160            feature = "UIView",
2161            feature = "block2"
2162        ))]
2163        /// Setter for [`previewParametersProvider`][Self::previewParametersProvider].
2164        #[unsafe(method(setPreviewParametersProvider:))]
2165        #[unsafe(method_family = none)]
2166        pub unsafe fn setPreviewParametersProvider(
2167            &self,
2168            preview_parameters_provider: Option<
2169                &block2::DynBlock<
2170                    dyn Fn(NonNull<UICollectionViewCell>) -> *mut UIDragPreviewParameters,
2171                >,
2172            >,
2173        );
2174    );
2175}
2176
2177/// Methods declared on superclass `UICollectionViewPlaceholder`.
2178impl UICollectionViewDropPlaceholder {
2179    extern_methods!(
2180        #[unsafe(method(initWithInsertionIndexPath:reuseIdentifier:))]
2181        #[unsafe(method_family = init)]
2182        pub unsafe fn initWithInsertionIndexPath_reuseIdentifier(
2183            this: Allocated<Self>,
2184            insertion_index_path: &NSIndexPath,
2185            reuse_identifier: &NSString,
2186        ) -> Retained<Self>;
2187
2188        #[unsafe(method(init))]
2189        #[unsafe(method_family = init)]
2190        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2191
2192        #[unsafe(method(new))]
2193        #[unsafe(method_family = new)]
2194        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
2195    );
2196}
2197
2198extern_protocol!(
2199    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdropitem?language=objc)
2200    pub unsafe trait UICollectionViewDropItem: NSObjectProtocol + MainThreadOnly {
2201        #[cfg(feature = "UIDragItem")]
2202        #[unsafe(method(dragItem))]
2203        #[unsafe(method_family = none)]
2204        unsafe fn dragItem(&self) -> Retained<UIDragItem>;
2205
2206        #[unsafe(method(sourceIndexPath))]
2207        #[unsafe(method_family = none)]
2208        unsafe fn sourceIndexPath(&self) -> Option<Retained<NSIndexPath>>;
2209
2210        #[cfg(feature = "objc2-core-foundation")]
2211        #[unsafe(method(previewSize))]
2212        #[unsafe(method_family = none)]
2213        unsafe fn previewSize(&self) -> CGSize;
2214    }
2215);
2216
2217extern_protocol!(
2218    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdropplaceholdercontext?language=objc)
2219    #[cfg(feature = "UIDragInteraction")]
2220    pub unsafe trait UICollectionViewDropPlaceholderContext:
2221        UIDragAnimating + MainThreadOnly
2222    {
2223        #[cfg(feature = "UIDragItem")]
2224        #[unsafe(method(dragItem))]
2225        #[unsafe(method_family = none)]
2226        unsafe fn dragItem(&self) -> Retained<UIDragItem>;
2227
2228        #[cfg(feature = "block2")]
2229        #[unsafe(method(commitInsertionWithDataSourceUpdates:))]
2230        #[unsafe(method_family = none)]
2231        unsafe fn commitInsertionWithDataSourceUpdates(
2232            &self,
2233            data_source_updates: &block2::DynBlock<dyn Fn(NonNull<NSIndexPath>) + '_>,
2234        ) -> bool;
2235
2236        #[unsafe(method(deletePlaceholder))]
2237        #[unsafe(method_family = none)]
2238        unsafe fn deletePlaceholder(&self) -> bool;
2239
2240        #[unsafe(method(setNeedsCellUpdate))]
2241        #[unsafe(method_family = none)]
2242        unsafe fn setNeedsCellUpdate(&self);
2243    }
2244);