1use 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#[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#[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#[repr(transparent)]
72#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
73pub struct UICollectionViewSelfSizingInvalidation(pub NSInteger);
74impl UICollectionViewSelfSizingInvalidation {
75 #[doc(alias = "UICollectionViewSelfSizingInvalidationDisabled")]
77 pub const Disabled: Self = Self(0);
78 #[doc(alias = "UICollectionViewSelfSizingInvalidationEnabled")]
80 pub const Enabled: Self = Self(1);
81 #[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#[cfg(feature = "block2")]
97pub type UICollectionViewLayoutInteractiveTransitionCompletion =
98 *mut block2::Block<dyn Fn(Bool, Bool)>;
99
100extern_class!(
101 #[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")]
110unsafe impl NSObjectProtocol for UICollectionViewFocusUpdateContext {}
111
112#[cfg(feature = "UIFocus")]
113impl UICollectionViewFocusUpdateContext {
114 extern_methods!(
115 #[unsafe(method(previouslyFocusedIndexPath))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn previouslyFocusedIndexPath(&self) -> Option<Retained<NSIndexPath>>;
118
119 #[unsafe(method(nextFocusedIndexPath))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn nextFocusedIndexPath(&self) -> Option<Retained<NSIndexPath>>;
122 );
123}
124
125#[cfg(feature = "UIFocus")]
127impl UICollectionViewFocusUpdateContext {
128 extern_methods!(
129 #[unsafe(method(init))]
130 #[unsafe(method_family = init)]
131 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
132
133 #[unsafe(method(new))]
134 #[unsafe(method_family = new)]
135 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
136 );
137}
138
139extern_protocol!(
140 pub unsafe trait UICollectionViewDataSource: NSObjectProtocol + MainThreadOnly {
142 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
143 #[unsafe(method(collectionView:numberOfItemsInSection:))]
144 #[unsafe(method_family = none)]
145 unsafe fn collectionView_numberOfItemsInSection(
146 &self,
147 collection_view: &UICollectionView,
148 section: NSInteger,
149 ) -> NSInteger;
150
151 #[cfg(all(
152 feature = "UICollectionViewCell",
153 feature = "UIResponder",
154 feature = "UIScrollView",
155 feature = "UIView"
156 ))]
157 #[unsafe(method(collectionView:cellForItemAtIndexPath:))]
158 #[unsafe(method_family = none)]
159 unsafe fn collectionView_cellForItemAtIndexPath(
160 &self,
161 collection_view: &UICollectionView,
162 index_path: &NSIndexPath,
163 ) -> Retained<UICollectionViewCell>;
164
165 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
166 #[optional]
167 #[unsafe(method(numberOfSectionsInCollectionView:))]
168 #[unsafe(method_family = none)]
169 unsafe fn numberOfSectionsInCollectionView(
170 &self,
171 collection_view: &UICollectionView,
172 ) -> NSInteger;
173
174 #[cfg(all(
175 feature = "UICollectionViewCell",
176 feature = "UIResponder",
177 feature = "UIScrollView",
178 feature = "UIView"
179 ))]
180 #[optional]
181 #[unsafe(method(collectionView:viewForSupplementaryElementOfKind:atIndexPath:))]
182 #[unsafe(method_family = none)]
183 unsafe fn collectionView_viewForSupplementaryElementOfKind_atIndexPath(
184 &self,
185 collection_view: &UICollectionView,
186 kind: &NSString,
187 index_path: &NSIndexPath,
188 ) -> Retained<UICollectionReusableView>;
189
190 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
191 #[optional]
192 #[unsafe(method(collectionView:canMoveItemAtIndexPath:))]
193 #[unsafe(method_family = none)]
194 unsafe fn collectionView_canMoveItemAtIndexPath(
195 &self,
196 collection_view: &UICollectionView,
197 index_path: &NSIndexPath,
198 ) -> bool;
199
200 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
201 #[optional]
202 #[unsafe(method(collectionView:moveItemAtIndexPath:toIndexPath:))]
203 #[unsafe(method_family = none)]
204 unsafe fn collectionView_moveItemAtIndexPath_toIndexPath(
205 &self,
206 collection_view: &UICollectionView,
207 source_index_path: &NSIndexPath,
208 destination_index_path: &NSIndexPath,
209 );
210
211 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
212 #[optional]
214 #[unsafe(method(indexTitlesForCollectionView:))]
215 #[unsafe(method_family = none)]
216 unsafe fn indexTitlesForCollectionView(
217 &self,
218 collection_view: &UICollectionView,
219 ) -> Option<Retained<NSArray<NSString>>>;
220
221 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
222 #[optional]
225 #[unsafe(method(collectionView:indexPathForIndexTitle:atIndex:))]
226 #[unsafe(method_family = none)]
227 unsafe fn collectionView_indexPathForIndexTitle_atIndex(
228 &self,
229 collection_view: &UICollectionView,
230 title: &NSString,
231 index: NSInteger,
232 ) -> Retained<NSIndexPath>;
233 }
234);
235
236extern_protocol!(
237 pub unsafe trait UICollectionViewDataSourcePrefetching:
239 NSObjectProtocol + MainThreadOnly
240 {
241 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
242 #[unsafe(method(collectionView:prefetchItemsAtIndexPaths:))]
243 #[unsafe(method_family = none)]
244 unsafe fn collectionView_prefetchItemsAtIndexPaths(
245 &self,
246 collection_view: &UICollectionView,
247 index_paths: &NSArray<NSIndexPath>,
248 );
249
250 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
251 #[optional]
252 #[unsafe(method(collectionView:cancelPrefetchingForItemsAtIndexPaths:))]
253 #[unsafe(method_family = none)]
254 unsafe fn collectionView_cancelPrefetchingForItemsAtIndexPaths(
255 &self,
256 collection_view: &UICollectionView,
257 index_paths: &NSArray<NSIndexPath>,
258 );
259 }
260);
261
262extern_protocol!(
263 #[cfg(feature = "UIScrollView")]
265 pub unsafe trait UICollectionViewDelegate:
266 UIScrollViewDelegate + MainThreadOnly
267 {
268 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
269 #[optional]
270 #[unsafe(method(collectionView:shouldHighlightItemAtIndexPath:))]
271 #[unsafe(method_family = none)]
272 unsafe fn collectionView_shouldHighlightItemAtIndexPath(
273 &self,
274 collection_view: &UICollectionView,
275 index_path: &NSIndexPath,
276 ) -> bool;
277
278 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
279 #[optional]
280 #[unsafe(method(collectionView:didHighlightItemAtIndexPath:))]
281 #[unsafe(method_family = none)]
282 unsafe fn collectionView_didHighlightItemAtIndexPath(
283 &self,
284 collection_view: &UICollectionView,
285 index_path: &NSIndexPath,
286 );
287
288 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
289 #[optional]
290 #[unsafe(method(collectionView:didUnhighlightItemAtIndexPath:))]
291 #[unsafe(method_family = none)]
292 unsafe fn collectionView_didUnhighlightItemAtIndexPath(
293 &self,
294 collection_view: &UICollectionView,
295 index_path: &NSIndexPath,
296 );
297
298 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
299 #[optional]
300 #[unsafe(method(collectionView:shouldSelectItemAtIndexPath:))]
301 #[unsafe(method_family = none)]
302 unsafe fn collectionView_shouldSelectItemAtIndexPath(
303 &self,
304 collection_view: &UICollectionView,
305 index_path: &NSIndexPath,
306 ) -> bool;
307
308 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
309 #[optional]
310 #[unsafe(method(collectionView:shouldDeselectItemAtIndexPath:))]
311 #[unsafe(method_family = none)]
312 unsafe fn collectionView_shouldDeselectItemAtIndexPath(
313 &self,
314 collection_view: &UICollectionView,
315 index_path: &NSIndexPath,
316 ) -> bool;
317
318 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
319 #[optional]
320 #[unsafe(method(collectionView:didSelectItemAtIndexPath:))]
321 #[unsafe(method_family = none)]
322 unsafe fn collectionView_didSelectItemAtIndexPath(
323 &self,
324 collection_view: &UICollectionView,
325 index_path: &NSIndexPath,
326 );
327
328 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
329 #[optional]
330 #[unsafe(method(collectionView:didDeselectItemAtIndexPath:))]
331 #[unsafe(method_family = none)]
332 unsafe fn collectionView_didDeselectItemAtIndexPath(
333 &self,
334 collection_view: &UICollectionView,
335 index_path: &NSIndexPath,
336 );
337
338 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
339 #[optional]
352 #[unsafe(method(collectionView:canPerformPrimaryActionForItemAtIndexPath:))]
353 #[unsafe(method_family = none)]
354 unsafe fn collectionView_canPerformPrimaryActionForItemAtIndexPath(
355 &self,
356 collection_view: &UICollectionView,
357 index_path: &NSIndexPath,
358 ) -> bool;
359
360 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
361 #[optional]
380 #[unsafe(method(collectionView:performPrimaryActionForItemAtIndexPath:))]
381 #[unsafe(method_family = none)]
382 unsafe fn collectionView_performPrimaryActionForItemAtIndexPath(
383 &self,
384 collection_view: &UICollectionView,
385 index_path: &NSIndexPath,
386 );
387
388 #[cfg(all(
389 feature = "UICollectionViewCell",
390 feature = "UIResponder",
391 feature = "UIView"
392 ))]
393 #[optional]
394 #[unsafe(method(collectionView:willDisplayCell:forItemAtIndexPath:))]
395 #[unsafe(method_family = none)]
396 unsafe fn collectionView_willDisplayCell_forItemAtIndexPath(
397 &self,
398 collection_view: &UICollectionView,
399 cell: &UICollectionViewCell,
400 index_path: &NSIndexPath,
401 );
402
403 #[cfg(all(
404 feature = "UICollectionViewCell",
405 feature = "UIResponder",
406 feature = "UIView"
407 ))]
408 #[optional]
409 #[unsafe(method(collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:))]
410 #[unsafe(method_family = none)]
411 unsafe fn collectionView_willDisplaySupplementaryView_forElementKind_atIndexPath(
412 &self,
413 collection_view: &UICollectionView,
414 view: &UICollectionReusableView,
415 element_kind: &NSString,
416 index_path: &NSIndexPath,
417 );
418
419 #[cfg(all(
420 feature = "UICollectionViewCell",
421 feature = "UIResponder",
422 feature = "UIView"
423 ))]
424 #[optional]
425 #[unsafe(method(collectionView:didEndDisplayingCell:forItemAtIndexPath:))]
426 #[unsafe(method_family = none)]
427 unsafe fn collectionView_didEndDisplayingCell_forItemAtIndexPath(
428 &self,
429 collection_view: &UICollectionView,
430 cell: &UICollectionViewCell,
431 index_path: &NSIndexPath,
432 );
433
434 #[cfg(all(
435 feature = "UICollectionViewCell",
436 feature = "UIResponder",
437 feature = "UIView"
438 ))]
439 #[optional]
440 #[unsafe(method(collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:))]
441 #[unsafe(method_family = none)]
442 unsafe fn collectionView_didEndDisplayingSupplementaryView_forElementOfKind_atIndexPath(
443 &self,
444 collection_view: &UICollectionView,
445 view: &UICollectionReusableView,
446 element_kind: &NSString,
447 index_path: &NSIndexPath,
448 );
449
450 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
451 #[deprecated]
452 #[optional]
453 #[unsafe(method(collectionView:shouldShowMenuForItemAtIndexPath:))]
454 #[unsafe(method_family = none)]
455 unsafe fn collectionView_shouldShowMenuForItemAtIndexPath(
456 &self,
457 collection_view: &UICollectionView,
458 index_path: &NSIndexPath,
459 ) -> bool;
460
461 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
462 #[deprecated]
463 #[optional]
464 #[unsafe(method(collectionView:canPerformAction:forItemAtIndexPath:withSender:))]
465 #[unsafe(method_family = none)]
466 unsafe fn collectionView_canPerformAction_forItemAtIndexPath_withSender(
467 &self,
468 collection_view: &UICollectionView,
469 action: Sel,
470 index_path: &NSIndexPath,
471 sender: Option<&AnyObject>,
472 ) -> bool;
473
474 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
475 #[deprecated]
476 #[optional]
477 #[unsafe(method(collectionView:performAction:forItemAtIndexPath:withSender:))]
478 #[unsafe(method_family = none)]
479 unsafe fn collectionView_performAction_forItemAtIndexPath_withSender(
480 &self,
481 collection_view: &UICollectionView,
482 action: Sel,
483 index_path: &NSIndexPath,
484 sender: Option<&AnyObject>,
485 );
486
487 #[cfg(all(
488 feature = "UICollectionViewLayout",
489 feature = "UICollectionViewTransitionLayout",
490 feature = "UIResponder",
491 feature = "UIView"
492 ))]
493 #[optional]
494 #[unsafe(method(collectionView:transitionLayoutForOldLayout:newLayout:))]
495 #[unsafe(method_family = none)]
496 unsafe fn collectionView_transitionLayoutForOldLayout_newLayout(
497 &self,
498 collection_view: &UICollectionView,
499 from_layout: &UICollectionViewLayout,
500 to_layout: &UICollectionViewLayout,
501 ) -> Retained<UICollectionViewTransitionLayout>;
502
503 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
504 #[optional]
505 #[unsafe(method(collectionView:canFocusItemAtIndexPath:))]
506 #[unsafe(method_family = none)]
507 unsafe fn collectionView_canFocusItemAtIndexPath(
508 &self,
509 collection_view: &UICollectionView,
510 index_path: &NSIndexPath,
511 ) -> bool;
512
513 #[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
514 #[optional]
515 #[unsafe(method(collectionView:shouldUpdateFocusInContext:))]
516 #[unsafe(method_family = none)]
517 unsafe fn collectionView_shouldUpdateFocusInContext(
518 &self,
519 collection_view: &UICollectionView,
520 context: &UICollectionViewFocusUpdateContext,
521 ) -> bool;
522
523 #[cfg(all(
524 feature = "UIFocus",
525 feature = "UIFocusAnimationCoordinator",
526 feature = "UIResponder",
527 feature = "UIView"
528 ))]
529 #[optional]
530 #[unsafe(method(collectionView:didUpdateFocusInContext:withAnimationCoordinator:))]
531 #[unsafe(method_family = none)]
532 unsafe fn collectionView_didUpdateFocusInContext_withAnimationCoordinator(
533 &self,
534 collection_view: &UICollectionView,
535 context: &UICollectionViewFocusUpdateContext,
536 coordinator: &UIFocusAnimationCoordinator,
537 );
538
539 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
540 #[optional]
541 #[unsafe(method(indexPathForPreferredFocusedViewInCollectionView:))]
542 #[unsafe(method_family = none)]
543 unsafe fn indexPathForPreferredFocusedViewInCollectionView(
544 &self,
545 collection_view: &UICollectionView,
546 ) -> Option<Retained<NSIndexPath>>;
547
548 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
549 #[optional]
552 #[unsafe(method(collectionView:selectionFollowsFocusForItemAtIndexPath:))]
553 #[unsafe(method_family = none)]
554 unsafe fn collectionView_selectionFollowsFocusForItemAtIndexPath(
555 &self,
556 collection_view: &UICollectionView,
557 index_path: &NSIndexPath,
558 ) -> bool;
559
560 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
561 #[optional]
562 #[unsafe(method(collectionView:targetIndexPathForMoveOfItemFromOriginalIndexPath:atCurrentIndexPath:toProposedIndexPath:))]
563 #[unsafe(method_family = none)]
564 unsafe fn collectionView_targetIndexPathForMoveOfItemFromOriginalIndexPath_atCurrentIndexPath_toProposedIndexPath(
565 &self,
566 collection_view: &UICollectionView,
567 original_index_path: &NSIndexPath,
568 current_index_path: &NSIndexPath,
569 proposed_index_path: &NSIndexPath,
570 ) -> Retained<NSIndexPath>;
571
572 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
573 #[deprecated]
574 #[optional]
575 #[unsafe(method(collectionView:targetIndexPathForMoveFromItemAtIndexPath:toProposedIndexPath:))]
576 #[unsafe(method_family = none)]
577 unsafe fn collectionView_targetIndexPathForMoveFromItemAtIndexPath_toProposedIndexPath(
578 &self,
579 collection_view: &UICollectionView,
580 current_index_path: &NSIndexPath,
581 proposed_index_path: &NSIndexPath,
582 ) -> Retained<NSIndexPath>;
583
584 #[cfg(all(
585 feature = "UIResponder",
586 feature = "UIView",
587 feature = "objc2-core-foundation"
588 ))]
589 #[optional]
590 #[unsafe(method(collectionView:targetContentOffsetForProposedContentOffset:))]
591 #[unsafe(method_family = none)]
592 unsafe fn collectionView_targetContentOffsetForProposedContentOffset(
593 &self,
594 collection_view: &UICollectionView,
595 proposed_content_offset: CGPoint,
596 ) -> CGPoint;
597
598 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
599 #[optional]
600 #[unsafe(method(collectionView:canEditItemAtIndexPath:))]
601 #[unsafe(method_family = none)]
602 unsafe fn collectionView_canEditItemAtIndexPath(
603 &self,
604 collection_view: &UICollectionView,
605 index_path: &NSIndexPath,
606 ) -> bool;
607
608 #[cfg(all(
609 feature = "UIResponder",
610 feature = "UISpringLoadedInteraction",
611 feature = "UIView"
612 ))]
613 #[optional]
614 #[unsafe(method(collectionView:shouldSpringLoadItemAtIndexPath:withContext:))]
615 #[unsafe(method_family = none)]
616 unsafe fn collectionView_shouldSpringLoadItemAtIndexPath_withContext(
617 &self,
618 collection_view: &UICollectionView,
619 index_path: &NSIndexPath,
620 context: &ProtocolObject<dyn UISpringLoadedInteractionContext>,
621 ) -> bool;
622
623 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
624 #[optional]
625 #[unsafe(method(collectionView:shouldBeginMultipleSelectionInteractionAtIndexPath:))]
626 #[unsafe(method_family = none)]
627 unsafe fn collectionView_shouldBeginMultipleSelectionInteractionAtIndexPath(
628 &self,
629 collection_view: &UICollectionView,
630 index_path: &NSIndexPath,
631 ) -> bool;
632
633 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
634 #[optional]
635 #[unsafe(method(collectionView:didBeginMultipleSelectionInteractionAtIndexPath:))]
636 #[unsafe(method_family = none)]
637 unsafe fn collectionView_didBeginMultipleSelectionInteractionAtIndexPath(
638 &self,
639 collection_view: &UICollectionView,
640 index_path: &NSIndexPath,
641 );
642
643 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
644 #[optional]
645 #[unsafe(method(collectionViewDidEndMultipleSelectionInteraction:))]
646 #[unsafe(method_family = none)]
647 unsafe fn collectionViewDidEndMultipleSelectionInteraction(
648 &self,
649 collection_view: &UICollectionView,
650 );
651
652 #[cfg(all(
653 feature = "UIContextMenuConfiguration",
654 feature = "UIResponder",
655 feature = "UIView",
656 feature = "objc2-core-foundation"
657 ))]
658 #[optional]
680 #[unsafe(method(collectionView:contextMenuConfigurationForItemsAtIndexPaths:point:))]
681 #[unsafe(method_family = none)]
682 unsafe fn collectionView_contextMenuConfigurationForItemsAtIndexPaths_point(
683 &self,
684 collection_view: &UICollectionView,
685 index_paths: &NSArray<NSIndexPath>,
686 point: CGPoint,
687 ) -> Option<Retained<UIContextMenuConfiguration>>;
688
689 #[cfg(all(
690 feature = "UIContextMenuConfiguration",
691 feature = "UIResponder",
692 feature = "UITargetedPreview",
693 feature = "UIView"
694 ))]
695 #[optional]
706 #[unsafe(method(collectionView:contextMenuConfiguration:highlightPreviewForItemAtIndexPath:))]
707 #[unsafe(method_family = none)]
708 unsafe fn collectionView_contextMenuConfiguration_highlightPreviewForItemAtIndexPath(
709 &self,
710 collection_view: &UICollectionView,
711 configuration: &UIContextMenuConfiguration,
712 index_path: &NSIndexPath,
713 ) -> Option<Retained<UITargetedPreview>>;
714
715 #[cfg(all(
716 feature = "UIContextMenuConfiguration",
717 feature = "UIResponder",
718 feature = "UITargetedPreview",
719 feature = "UIView"
720 ))]
721 #[optional]
731 #[unsafe(method(collectionView:contextMenuConfiguration:dismissalPreviewForItemAtIndexPath:))]
732 #[unsafe(method_family = none)]
733 unsafe fn collectionView_contextMenuConfiguration_dismissalPreviewForItemAtIndexPath(
734 &self,
735 collection_view: &UICollectionView,
736 configuration: &UIContextMenuConfiguration,
737 index_path: &NSIndexPath,
738 ) -> Option<Retained<UITargetedPreview>>;
739
740 #[cfg(all(
741 feature = "UIContextMenuConfiguration",
742 feature = "UIContextMenuInteraction",
743 feature = "UIResponder",
744 feature = "UIView"
745 ))]
746 #[optional]
755 #[unsafe(method(collectionView:willPerformPreviewActionForMenuWithConfiguration:animator:))]
756 #[unsafe(method_family = none)]
757 unsafe fn collectionView_willPerformPreviewActionForMenuWithConfiguration_animator(
758 &self,
759 collection_view: &UICollectionView,
760 configuration: &UIContextMenuConfiguration,
761 animator: &ProtocolObject<dyn UIContextMenuInteractionCommitAnimating>,
762 );
763
764 #[cfg(all(
765 feature = "UIContextMenuConfiguration",
766 feature = "UIContextMenuInteraction",
767 feature = "UIResponder",
768 feature = "UIView"
769 ))]
770 #[optional]
779 #[unsafe(method(collectionView:willDisplayContextMenuWithConfiguration:animator:))]
780 #[unsafe(method_family = none)]
781 unsafe fn collectionView_willDisplayContextMenuWithConfiguration_animator(
782 &self,
783 collection_view: &UICollectionView,
784 configuration: &UIContextMenuConfiguration,
785 animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
786 );
787
788 #[cfg(all(
789 feature = "UIContextMenuConfiguration",
790 feature = "UIContextMenuInteraction",
791 feature = "UIResponder",
792 feature = "UIView"
793 ))]
794 #[optional]
803 #[unsafe(method(collectionView:willEndContextMenuInteractionWithConfiguration:animator:))]
804 #[unsafe(method_family = none)]
805 unsafe fn collectionView_willEndContextMenuInteractionWithConfiguration_animator(
806 &self,
807 collection_view: &UICollectionView,
808 configuration: &UIContextMenuConfiguration,
809 animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
810 );
811
812 #[cfg(all(
813 feature = "UIResponder",
814 feature = "UIView",
815 feature = "UIWindowSceneActivationConfiguration",
816 feature = "objc2-core-foundation"
817 ))]
818 #[optional]
828 #[unsafe(method(collectionView:sceneActivationConfigurationForItemAtIndexPath:point:))]
829 #[unsafe(method_family = none)]
830 unsafe fn collectionView_sceneActivationConfigurationForItemAtIndexPath_point(
831 &self,
832 collection_view: &UICollectionView,
833 index_path: &NSIndexPath,
834 point: CGPoint,
835 ) -> Option<Retained<UIWindowSceneActivationConfiguration>>;
836
837 #[cfg(all(
838 feature = "UIContextMenuConfiguration",
839 feature = "UIResponder",
840 feature = "UIView",
841 feature = "objc2-core-foundation"
842 ))]
843 #[deprecated]
858 #[optional]
859 #[unsafe(method(collectionView:contextMenuConfigurationForItemAtIndexPath:point:))]
860 #[unsafe(method_family = none)]
861 unsafe fn collectionView_contextMenuConfigurationForItemAtIndexPath_point(
862 &self,
863 collection_view: &UICollectionView,
864 index_path: &NSIndexPath,
865 point: CGPoint,
866 ) -> Option<Retained<UIContextMenuConfiguration>>;
867
868 #[cfg(all(
869 feature = "UIContextMenuConfiguration",
870 feature = "UIResponder",
871 feature = "UITargetedPreview",
872 feature = "UIView"
873 ))]
874 #[deprecated]
882 #[optional]
883 #[unsafe(method(collectionView:previewForHighlightingContextMenuWithConfiguration:))]
884 #[unsafe(method_family = none)]
885 unsafe fn collectionView_previewForHighlightingContextMenuWithConfiguration(
886 &self,
887 collection_view: &UICollectionView,
888 configuration: &UIContextMenuConfiguration,
889 ) -> Option<Retained<UITargetedPreview>>;
890
891 #[cfg(all(
892 feature = "UIContextMenuConfiguration",
893 feature = "UIResponder",
894 feature = "UITargetedPreview",
895 feature = "UIView"
896 ))]
897 #[deprecated]
906 #[optional]
907 #[unsafe(method(collectionView:previewForDismissingContextMenuWithConfiguration:))]
908 #[unsafe(method_family = none)]
909 unsafe fn collectionView_previewForDismissingContextMenuWithConfiguration(
910 &self,
911 collection_view: &UICollectionView,
912 configuration: &UIContextMenuConfiguration,
913 ) -> Option<Retained<UITargetedPreview>>;
914 }
915);
916
917extern_class!(
918 #[unsafe(super(UIScrollView, UIView, UIResponder, NSObject))]
920 #[thread_kind = MainThreadOnly]
921 #[derive(Debug, PartialEq, Eq, Hash)]
922 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
923 pub struct UICollectionView;
924);
925
926#[cfg(all(
927 feature = "UIResponder",
928 feature = "UIScrollView",
929 feature = "UIView",
930 feature = "objc2-quartz-core"
931))]
932#[cfg(not(target_os = "watchos"))]
933unsafe impl CALayerDelegate for UICollectionView {}
934
935#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
936unsafe impl NSCoding for UICollectionView {}
937
938#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
939unsafe impl NSObjectProtocol for UICollectionView {}
940
941#[cfg(all(
942 feature = "UIAppearance",
943 feature = "UIResponder",
944 feature = "UIScrollView",
945 feature = "UIView"
946))]
947unsafe impl UIAppearance for UICollectionView {}
948
949#[cfg(all(
950 feature = "UIAppearance",
951 feature = "UIResponder",
952 feature = "UIScrollView",
953 feature = "UIView"
954))]
955unsafe impl UIAppearanceContainer for UICollectionView {}
956
957#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
958unsafe impl UICoordinateSpace for UICollectionView {}
959
960#[cfg(all(
961 feature = "UIDataSourceTranslating",
962 feature = "UIResponder",
963 feature = "UIScrollView",
964 feature = "UIView"
965))]
966unsafe impl UIDataSourceTranslating for UICollectionView {}
967
968#[cfg(all(
969 feature = "UIDynamicBehavior",
970 feature = "UIResponder",
971 feature = "UIScrollView",
972 feature = "UIView"
973))]
974unsafe impl UIDynamicItem for UICollectionView {}
975
976#[cfg(all(
977 feature = "UIFocus",
978 feature = "UIResponder",
979 feature = "UIScrollView",
980 feature = "UIView"
981))]
982unsafe impl UIFocusEnvironment for UICollectionView {}
983
984#[cfg(all(
985 feature = "UIFocus",
986 feature = "UIResponder",
987 feature = "UIScrollView",
988 feature = "UIView"
989))]
990unsafe impl UIFocusItem for UICollectionView {}
991
992#[cfg(all(
993 feature = "UIFocus",
994 feature = "UIResponder",
995 feature = "UIScrollView",
996 feature = "UIView"
997))]
998unsafe impl UIFocusItemContainer for UICollectionView {}
999
1000#[cfg(all(
1001 feature = "UIFocus",
1002 feature = "UIResponder",
1003 feature = "UIScrollView",
1004 feature = "UIView"
1005))]
1006unsafe impl UIFocusItemScrollableContainer for UICollectionView {}
1007
1008#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1009unsafe impl UIResponderStandardEditActions for UICollectionView {}
1010
1011#[cfg(all(
1012 feature = "UIResponder",
1013 feature = "UIScrollView",
1014 feature = "UITraitCollection",
1015 feature = "UIView"
1016))]
1017unsafe impl UITraitEnvironment for UICollectionView {}
1018
1019#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1020impl UICollectionView {
1021 extern_methods!(
1022 #[cfg(all(feature = "UICollectionViewLayout", feature = "objc2-core-foundation"))]
1023 #[unsafe(method(initWithFrame:collectionViewLayout:))]
1024 #[unsafe(method_family = init)]
1025 pub unsafe fn initWithFrame_collectionViewLayout(
1026 this: Allocated<Self>,
1027 frame: CGRect,
1028 layout: &UICollectionViewLayout,
1029 ) -> Retained<Self>;
1030
1031 #[unsafe(method(initWithCoder:))]
1032 #[unsafe(method_family = init)]
1033 pub unsafe fn initWithCoder(
1034 this: Allocated<Self>,
1035 coder: &NSCoder,
1036 ) -> Option<Retained<Self>>;
1037
1038 #[cfg(feature = "UICollectionViewLayout")]
1039 #[unsafe(method(collectionViewLayout))]
1040 #[unsafe(method_family = none)]
1041 pub unsafe fn collectionViewLayout(&self) -> Retained<UICollectionViewLayout>;
1042
1043 #[cfg(feature = "UICollectionViewLayout")]
1044 #[unsafe(method(setCollectionViewLayout:))]
1046 #[unsafe(method_family = none)]
1047 pub unsafe fn setCollectionViewLayout(
1048 &self,
1049 collection_view_layout: &UICollectionViewLayout,
1050 );
1051
1052 #[unsafe(method(delegate))]
1053 #[unsafe(method_family = none)]
1054 pub unsafe fn delegate(
1055 &self,
1056 ) -> Option<Retained<ProtocolObject<dyn UICollectionViewDelegate>>>;
1057
1058 #[unsafe(method(setDelegate:))]
1061 #[unsafe(method_family = none)]
1062 pub unsafe fn setDelegate(
1063 &self,
1064 delegate: Option<&ProtocolObject<dyn UICollectionViewDelegate>>,
1065 );
1066
1067 #[unsafe(method(dataSource))]
1068 #[unsafe(method_family = none)]
1069 pub unsafe fn dataSource(
1070 &self,
1071 ) -> Option<Retained<ProtocolObject<dyn UICollectionViewDataSource>>>;
1072
1073 #[unsafe(method(setDataSource:))]
1076 #[unsafe(method_family = none)]
1077 pub unsafe fn setDataSource(
1078 &self,
1079 data_source: Option<&ProtocolObject<dyn UICollectionViewDataSource>>,
1080 );
1081
1082 #[unsafe(method(prefetchDataSource))]
1083 #[unsafe(method_family = none)]
1084 pub unsafe fn prefetchDataSource(
1085 &self,
1086 ) -> Option<Retained<ProtocolObject<dyn UICollectionViewDataSourcePrefetching>>>;
1087
1088 #[unsafe(method(setPrefetchDataSource:))]
1091 #[unsafe(method_family = none)]
1092 pub unsafe fn setPrefetchDataSource(
1093 &self,
1094 prefetch_data_source: Option<
1095 &ProtocolObject<dyn UICollectionViewDataSourcePrefetching>,
1096 >,
1097 );
1098
1099 #[unsafe(method(isPrefetchingEnabled))]
1100 #[unsafe(method_family = none)]
1101 pub unsafe fn isPrefetchingEnabled(&self) -> bool;
1102
1103 #[unsafe(method(setPrefetchingEnabled:))]
1105 #[unsafe(method_family = none)]
1106 pub unsafe fn setPrefetchingEnabled(&self, prefetching_enabled: bool);
1107
1108 #[unsafe(method(dragDelegate))]
1109 #[unsafe(method_family = none)]
1110 pub unsafe fn dragDelegate(
1111 &self,
1112 ) -> Option<Retained<ProtocolObject<dyn UICollectionViewDragDelegate>>>;
1113
1114 #[unsafe(method(setDragDelegate:))]
1117 #[unsafe(method_family = none)]
1118 pub unsafe fn setDragDelegate(
1119 &self,
1120 drag_delegate: Option<&ProtocolObject<dyn UICollectionViewDragDelegate>>,
1121 );
1122
1123 #[unsafe(method(dropDelegate))]
1124 #[unsafe(method_family = none)]
1125 pub unsafe fn dropDelegate(
1126 &self,
1127 ) -> Option<Retained<ProtocolObject<dyn UICollectionViewDropDelegate>>>;
1128
1129 #[unsafe(method(setDropDelegate:))]
1132 #[unsafe(method_family = none)]
1133 pub unsafe fn setDropDelegate(
1134 &self,
1135 drop_delegate: Option<&ProtocolObject<dyn UICollectionViewDropDelegate>>,
1136 );
1137
1138 #[unsafe(method(dragInteractionEnabled))]
1139 #[unsafe(method_family = none)]
1140 pub unsafe fn dragInteractionEnabled(&self) -> bool;
1141
1142 #[unsafe(method(setDragInteractionEnabled:))]
1144 #[unsafe(method_family = none)]
1145 pub unsafe fn setDragInteractionEnabled(&self, drag_interaction_enabled: bool);
1146
1147 #[cfg(feature = "UIContextMenuInteraction")]
1148 #[unsafe(method(contextMenuInteraction))]
1149 #[unsafe(method_family = none)]
1150 pub unsafe fn contextMenuInteraction(&self) -> Option<Retained<UIContextMenuInteraction>>;
1151
1152 #[unsafe(method(reorderingCadence))]
1153 #[unsafe(method_family = none)]
1154 pub unsafe fn reorderingCadence(&self) -> UICollectionViewReorderingCadence;
1155
1156 #[unsafe(method(setReorderingCadence:))]
1158 #[unsafe(method_family = none)]
1159 pub unsafe fn setReorderingCadence(
1160 &self,
1161 reordering_cadence: UICollectionViewReorderingCadence,
1162 );
1163
1164 #[unsafe(method(selfSizingInvalidation))]
1165 #[unsafe(method_family = none)]
1166 pub unsafe fn selfSizingInvalidation(&self) -> UICollectionViewSelfSizingInvalidation;
1167
1168 #[unsafe(method(setSelfSizingInvalidation:))]
1170 #[unsafe(method_family = none)]
1171 pub unsafe fn setSelfSizingInvalidation(
1172 &self,
1173 self_sizing_invalidation: UICollectionViewSelfSizingInvalidation,
1174 );
1175
1176 #[unsafe(method(backgroundView))]
1177 #[unsafe(method_family = none)]
1178 pub unsafe fn backgroundView(&self) -> Option<Retained<UIView>>;
1179
1180 #[unsafe(method(setBackgroundView:))]
1182 #[unsafe(method_family = none)]
1183 pub unsafe fn setBackgroundView(&self, background_view: Option<&UIView>);
1184
1185 #[unsafe(method(registerClass:forCellWithReuseIdentifier:))]
1186 #[unsafe(method_family = none)]
1187 pub unsafe fn registerClass_forCellWithReuseIdentifier(
1188 &self,
1189 cell_class: Option<&AnyClass>,
1190 identifier: &NSString,
1191 );
1192
1193 #[cfg(feature = "UINib")]
1194 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
1195 #[unsafe(method(registerNib:forCellWithReuseIdentifier:))]
1196 #[unsafe(method_family = none)]
1197 pub unsafe fn registerNib_forCellWithReuseIdentifier(
1198 &self,
1199 nib: Option<&UINib>,
1200 identifier: &NSString,
1201 );
1202
1203 #[unsafe(method(registerClass:forSupplementaryViewOfKind:withReuseIdentifier:))]
1204 #[unsafe(method_family = none)]
1205 pub unsafe fn registerClass_forSupplementaryViewOfKind_withReuseIdentifier(
1206 &self,
1207 view_class: Option<&AnyClass>,
1208 element_kind: &NSString,
1209 identifier: &NSString,
1210 );
1211
1212 #[cfg(feature = "UINib")]
1213 #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
1214 #[unsafe(method(registerNib:forSupplementaryViewOfKind:withReuseIdentifier:))]
1215 #[unsafe(method_family = none)]
1216 pub unsafe fn registerNib_forSupplementaryViewOfKind_withReuseIdentifier(
1217 &self,
1218 nib: Option<&UINib>,
1219 kind: &NSString,
1220 identifier: &NSString,
1221 );
1222
1223 #[cfg(feature = "UICollectionViewCell")]
1224 #[unsafe(method(dequeueReusableCellWithReuseIdentifier:forIndexPath:))]
1225 #[unsafe(method_family = none)]
1226 pub unsafe fn dequeueReusableCellWithReuseIdentifier_forIndexPath(
1227 &self,
1228 identifier: &NSString,
1229 index_path: &NSIndexPath,
1230 ) -> Retained<UICollectionViewCell>;
1231
1232 #[cfg(feature = "UICollectionViewCell")]
1233 #[unsafe(method(dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath:))]
1234 #[unsafe(method_family = none)]
1235 pub unsafe fn dequeueReusableSupplementaryViewOfKind_withReuseIdentifier_forIndexPath(
1236 &self,
1237 element_kind: &NSString,
1238 identifier: &NSString,
1239 index_path: &NSIndexPath,
1240 ) -> Retained<UICollectionReusableView>;
1241
1242 #[cfg(all(
1243 feature = "UICollectionViewCell",
1244 feature = "UICollectionViewItemRegistration"
1245 ))]
1246 #[unsafe(method(dequeueConfiguredReusableCellWithRegistration:forIndexPath:item:))]
1247 #[unsafe(method_family = none)]
1248 pub unsafe fn dequeueConfiguredReusableCellWithRegistration_forIndexPath_item(
1249 &self,
1250 registration: &UICollectionViewCellRegistration,
1251 index_path: &NSIndexPath,
1252 item: &AnyObject,
1253 ) -> Retained<UICollectionViewCell>;
1254
1255 #[cfg(all(
1256 feature = "UICollectionViewCell",
1257 feature = "UICollectionViewItemRegistration"
1258 ))]
1259 #[unsafe(method(dequeueConfiguredReusableSupplementaryViewWithRegistration:forIndexPath:))]
1260 #[unsafe(method_family = none)]
1261 pub unsafe fn dequeueConfiguredReusableSupplementaryViewWithRegistration_forIndexPath(
1262 &self,
1263 registration: &UICollectionViewSupplementaryRegistration,
1264 index_path: &NSIndexPath,
1265 ) -> Retained<UICollectionReusableView>;
1266
1267 #[unsafe(method(allowsSelection))]
1268 #[unsafe(method_family = none)]
1269 pub unsafe fn allowsSelection(&self) -> bool;
1270
1271 #[unsafe(method(setAllowsSelection:))]
1273 #[unsafe(method_family = none)]
1274 pub unsafe fn setAllowsSelection(&self, allows_selection: bool);
1275
1276 #[unsafe(method(allowsMultipleSelection))]
1277 #[unsafe(method_family = none)]
1278 pub unsafe fn allowsMultipleSelection(&self) -> bool;
1279
1280 #[unsafe(method(setAllowsMultipleSelection:))]
1282 #[unsafe(method_family = none)]
1283 pub unsafe fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
1284
1285 #[unsafe(method(indexPathsForSelectedItems))]
1286 #[unsafe(method_family = none)]
1287 pub unsafe fn indexPathsForSelectedItems(&self) -> Option<Retained<NSArray<NSIndexPath>>>;
1288
1289 #[unsafe(method(selectItemAtIndexPath:animated:scrollPosition:))]
1290 #[unsafe(method_family = none)]
1291 pub unsafe fn selectItemAtIndexPath_animated_scrollPosition(
1292 &self,
1293 index_path: Option<&NSIndexPath>,
1294 animated: bool,
1295 scroll_position: UICollectionViewScrollPosition,
1296 );
1297
1298 #[unsafe(method(deselectItemAtIndexPath:animated:))]
1299 #[unsafe(method_family = none)]
1300 pub unsafe fn deselectItemAtIndexPath_animated(
1301 &self,
1302 index_path: &NSIndexPath,
1303 animated: bool,
1304 );
1305
1306 #[unsafe(method(hasUncommittedUpdates))]
1307 #[unsafe(method_family = none)]
1308 pub unsafe fn hasUncommittedUpdates(&self) -> bool;
1309
1310 #[unsafe(method(reloadData))]
1311 #[unsafe(method_family = none)]
1312 pub unsafe fn reloadData(&self);
1313
1314 #[cfg(feature = "UICollectionViewLayout")]
1315 #[unsafe(method(setCollectionViewLayout:animated:))]
1316 #[unsafe(method_family = none)]
1317 pub unsafe fn setCollectionViewLayout_animated(
1318 &self,
1319 layout: &UICollectionViewLayout,
1320 animated: bool,
1321 );
1322
1323 #[cfg(all(feature = "UICollectionViewLayout", feature = "block2"))]
1324 #[unsafe(method(setCollectionViewLayout:animated:completion:))]
1325 #[unsafe(method_family = none)]
1326 pub unsafe fn setCollectionViewLayout_animated_completion(
1327 &self,
1328 layout: &UICollectionViewLayout,
1329 animated: bool,
1330 completion: Option<&block2::Block<dyn Fn(Bool)>>,
1331 );
1332
1333 #[cfg(all(
1334 feature = "UICollectionViewLayout",
1335 feature = "UICollectionViewTransitionLayout",
1336 feature = "block2"
1337 ))]
1338 #[unsafe(method(startInteractiveTransitionToCollectionViewLayout:completion:))]
1339 #[unsafe(method_family = none)]
1340 pub unsafe fn startInteractiveTransitionToCollectionViewLayout_completion(
1341 &self,
1342 layout: &UICollectionViewLayout,
1343 completion: UICollectionViewLayoutInteractiveTransitionCompletion,
1344 ) -> Retained<UICollectionViewTransitionLayout>;
1345
1346 #[unsafe(method(finishInteractiveTransition))]
1347 #[unsafe(method_family = none)]
1348 pub unsafe fn finishInteractiveTransition(&self);
1349
1350 #[unsafe(method(cancelInteractiveTransition))]
1351 #[unsafe(method_family = none)]
1352 pub unsafe fn cancelInteractiveTransition(&self);
1353
1354 #[unsafe(method(numberOfSections))]
1355 #[unsafe(method_family = none)]
1356 pub unsafe fn numberOfSections(&self) -> NSInteger;
1357
1358 #[unsafe(method(numberOfItemsInSection:))]
1359 #[unsafe(method_family = none)]
1360 pub unsafe fn numberOfItemsInSection(&self, section: NSInteger) -> NSInteger;
1361
1362 #[cfg(feature = "UICollectionViewLayout")]
1363 #[unsafe(method(layoutAttributesForItemAtIndexPath:))]
1364 #[unsafe(method_family = none)]
1365 pub unsafe fn layoutAttributesForItemAtIndexPath(
1366 &self,
1367 index_path: &NSIndexPath,
1368 ) -> Option<Retained<UICollectionViewLayoutAttributes>>;
1369
1370 #[cfg(feature = "UICollectionViewLayout")]
1371 #[unsafe(method(layoutAttributesForSupplementaryElementOfKind:atIndexPath:))]
1372 #[unsafe(method_family = none)]
1373 pub unsafe fn layoutAttributesForSupplementaryElementOfKind_atIndexPath(
1374 &self,
1375 kind: &NSString,
1376 index_path: &NSIndexPath,
1377 ) -> Option<Retained<UICollectionViewLayoutAttributes>>;
1378
1379 #[cfg(feature = "objc2-core-foundation")]
1380 #[unsafe(method(indexPathForItemAtPoint:))]
1381 #[unsafe(method_family = none)]
1382 pub unsafe fn indexPathForItemAtPoint(
1383 &self,
1384 point: CGPoint,
1385 ) -> Option<Retained<NSIndexPath>>;
1386
1387 #[cfg(feature = "UICollectionViewCell")]
1388 #[unsafe(method(indexPathForCell:))]
1389 #[unsafe(method_family = none)]
1390 pub unsafe fn indexPathForCell(
1391 &self,
1392 cell: &UICollectionViewCell,
1393 ) -> Option<Retained<NSIndexPath>>;
1394
1395 #[cfg(feature = "UICollectionViewCell")]
1396 #[unsafe(method(indexPathForSupplementaryView:))]
1402 #[unsafe(method_family = none)]
1403 pub unsafe fn indexPathForSupplementaryView(
1404 &self,
1405 supplementary_view: &UICollectionReusableView,
1406 ) -> Option<Retained<NSIndexPath>>;
1407
1408 #[cfg(feature = "UICollectionViewCell")]
1409 #[unsafe(method(cellForItemAtIndexPath:))]
1410 #[unsafe(method_family = none)]
1411 pub unsafe fn cellForItemAtIndexPath(
1412 &self,
1413 index_path: &NSIndexPath,
1414 ) -> Option<Retained<UICollectionViewCell>>;
1415
1416 #[cfg(feature = "UICollectionViewCell")]
1417 #[unsafe(method(visibleCells))]
1418 #[unsafe(method_family = none)]
1419 pub unsafe fn visibleCells(&self) -> Retained<NSArray<UICollectionViewCell>>;
1420
1421 #[unsafe(method(indexPathsForVisibleItems))]
1422 #[unsafe(method_family = none)]
1423 pub unsafe fn indexPathsForVisibleItems(&self) -> Retained<NSArray<NSIndexPath>>;
1424
1425 #[cfg(feature = "UICollectionViewCell")]
1426 #[unsafe(method(supplementaryViewForElementKind:atIndexPath:))]
1427 #[unsafe(method_family = none)]
1428 pub unsafe fn supplementaryViewForElementKind_atIndexPath(
1429 &self,
1430 element_kind: &NSString,
1431 index_path: &NSIndexPath,
1432 ) -> Option<Retained<UICollectionReusableView>>;
1433
1434 #[cfg(feature = "UICollectionViewCell")]
1435 #[unsafe(method(visibleSupplementaryViewsOfKind:))]
1436 #[unsafe(method_family = none)]
1437 pub unsafe fn visibleSupplementaryViewsOfKind(
1438 &self,
1439 element_kind: &NSString,
1440 ) -> Retained<NSArray<UICollectionReusableView>>;
1441
1442 #[unsafe(method(indexPathsForVisibleSupplementaryElementsOfKind:))]
1443 #[unsafe(method_family = none)]
1444 pub unsafe fn indexPathsForVisibleSupplementaryElementsOfKind(
1445 &self,
1446 element_kind: &NSString,
1447 ) -> Retained<NSArray<NSIndexPath>>;
1448
1449 #[unsafe(method(scrollToItemAtIndexPath:atScrollPosition:animated:))]
1450 #[unsafe(method_family = none)]
1451 pub unsafe fn scrollToItemAtIndexPath_atScrollPosition_animated(
1452 &self,
1453 index_path: &NSIndexPath,
1454 scroll_position: UICollectionViewScrollPosition,
1455 animated: bool,
1456 );
1457
1458 #[unsafe(method(insertSections:))]
1459 #[unsafe(method_family = none)]
1460 pub unsafe fn insertSections(&self, sections: &NSIndexSet);
1461
1462 #[unsafe(method(deleteSections:))]
1463 #[unsafe(method_family = none)]
1464 pub unsafe fn deleteSections(&self, sections: &NSIndexSet);
1465
1466 #[unsafe(method(moveSection:toSection:))]
1467 #[unsafe(method_family = none)]
1468 pub unsafe fn moveSection_toSection(&self, section: NSInteger, new_section: NSInteger);
1469
1470 #[unsafe(method(reloadSections:))]
1471 #[unsafe(method_family = none)]
1472 pub unsafe fn reloadSections(&self, sections: &NSIndexSet);
1473
1474 #[unsafe(method(insertItemsAtIndexPaths:))]
1475 #[unsafe(method_family = none)]
1476 pub unsafe fn insertItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
1477
1478 #[unsafe(method(deleteItemsAtIndexPaths:))]
1479 #[unsafe(method_family = none)]
1480 pub unsafe fn deleteItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
1481
1482 #[unsafe(method(moveItemAtIndexPath:toIndexPath:))]
1483 #[unsafe(method_family = none)]
1484 pub unsafe fn moveItemAtIndexPath_toIndexPath(
1485 &self,
1486 index_path: &NSIndexPath,
1487 new_index_path: &NSIndexPath,
1488 );
1489
1490 #[unsafe(method(reloadItemsAtIndexPaths:))]
1491 #[unsafe(method_family = none)]
1492 pub unsafe fn reloadItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
1493
1494 #[unsafe(method(reconfigureItemsAtIndexPaths:))]
1495 #[unsafe(method_family = none)]
1496 pub unsafe fn reconfigureItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
1497
1498 #[cfg(feature = "block2")]
1499 #[unsafe(method(performBatchUpdates:completion:))]
1500 #[unsafe(method_family = none)]
1501 pub unsafe fn performBatchUpdates_completion(
1502 &self,
1503 updates: Option<&block2::Block<dyn Fn() + '_>>,
1504 completion: Option<&block2::Block<dyn Fn(Bool)>>,
1505 );
1506
1507 #[unsafe(method(beginInteractiveMovementForItemAtIndexPath:))]
1508 #[unsafe(method_family = none)]
1509 pub unsafe fn beginInteractiveMovementForItemAtIndexPath(
1510 &self,
1511 index_path: &NSIndexPath,
1512 ) -> bool;
1513
1514 #[cfg(feature = "objc2-core-foundation")]
1515 #[unsafe(method(updateInteractiveMovementTargetPosition:))]
1516 #[unsafe(method_family = none)]
1517 pub unsafe fn updateInteractiveMovementTargetPosition(&self, target_position: CGPoint);
1518
1519 #[unsafe(method(endInteractiveMovement))]
1520 #[unsafe(method_family = none)]
1521 pub unsafe fn endInteractiveMovement(&self);
1522
1523 #[unsafe(method(cancelInteractiveMovement))]
1524 #[unsafe(method_family = none)]
1525 pub unsafe fn cancelInteractiveMovement(&self);
1526
1527 #[unsafe(method(remembersLastFocusedIndexPath))]
1528 #[unsafe(method_family = none)]
1529 pub unsafe fn remembersLastFocusedIndexPath(&self) -> bool;
1530
1531 #[unsafe(method(setRemembersLastFocusedIndexPath:))]
1533 #[unsafe(method_family = none)]
1534 pub unsafe fn setRemembersLastFocusedIndexPath(
1535 &self,
1536 remembers_last_focused_index_path: bool,
1537 );
1538
1539 #[unsafe(method(selectionFollowsFocus))]
1542 #[unsafe(method_family = none)]
1543 pub unsafe fn selectionFollowsFocus(&self) -> bool;
1544
1545 #[unsafe(method(setSelectionFollowsFocus:))]
1547 #[unsafe(method_family = none)]
1548 pub unsafe fn setSelectionFollowsFocus(&self, selection_follows_focus: bool);
1549
1550 #[unsafe(method(allowsFocus))]
1554 #[unsafe(method_family = none)]
1555 pub unsafe fn allowsFocus(&self) -> bool;
1556
1557 #[unsafe(method(setAllowsFocus:))]
1559 #[unsafe(method_family = none)]
1560 pub unsafe fn setAllowsFocus(&self, allows_focus: bool);
1561
1562 #[unsafe(method(allowsFocusDuringEditing))]
1566 #[unsafe(method_family = none)]
1567 pub unsafe fn allowsFocusDuringEditing(&self) -> bool;
1568
1569 #[unsafe(method(setAllowsFocusDuringEditing:))]
1571 #[unsafe(method_family = none)]
1572 pub unsafe fn setAllowsFocusDuringEditing(&self, allows_focus_during_editing: bool);
1573
1574 #[unsafe(method(hasActiveDrag))]
1575 #[unsafe(method_family = none)]
1576 pub unsafe fn hasActiveDrag(&self) -> bool;
1577
1578 #[unsafe(method(hasActiveDrop))]
1579 #[unsafe(method_family = none)]
1580 pub unsafe fn hasActiveDrop(&self) -> bool;
1581
1582 #[unsafe(method(isEditing))]
1583 #[unsafe(method_family = none)]
1584 pub unsafe fn isEditing(&self) -> bool;
1585
1586 #[unsafe(method(setEditing:))]
1588 #[unsafe(method_family = none)]
1589 pub unsafe fn setEditing(&self, editing: bool);
1590
1591 #[unsafe(method(allowsSelectionDuringEditing))]
1592 #[unsafe(method_family = none)]
1593 pub unsafe fn allowsSelectionDuringEditing(&self) -> bool;
1594
1595 #[unsafe(method(setAllowsSelectionDuringEditing:))]
1597 #[unsafe(method_family = none)]
1598 pub unsafe fn setAllowsSelectionDuringEditing(&self, allows_selection_during_editing: bool);
1599
1600 #[unsafe(method(allowsMultipleSelectionDuringEditing))]
1601 #[unsafe(method_family = none)]
1602 pub unsafe fn allowsMultipleSelectionDuringEditing(&self) -> bool;
1603
1604 #[unsafe(method(setAllowsMultipleSelectionDuringEditing:))]
1606 #[unsafe(method_family = none)]
1607 pub unsafe fn setAllowsMultipleSelectionDuringEditing(
1608 &self,
1609 allows_multiple_selection_during_editing: bool,
1610 );
1611 );
1612}
1613
1614#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1616impl UICollectionView {
1617 extern_methods!(
1618 #[cfg(feature = "objc2-core-foundation")]
1619 #[unsafe(method(initWithFrame:))]
1620 #[unsafe(method_family = init)]
1621 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
1622 );
1623}
1624
1625#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1627impl UICollectionView {
1628 extern_methods!(
1629 #[unsafe(method(init))]
1630 #[unsafe(method_family = init)]
1631 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1632
1633 #[unsafe(method(new))]
1634 #[unsafe(method_family = new)]
1635 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1636 );
1637}
1638
1639#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1641impl UICollectionView {
1642 extern_methods!();
1643}
1644
1645#[cfg(all(
1646 feature = "UIResponder",
1647 feature = "UIScrollView",
1648 feature = "UISpringLoadedInteractionSupporting",
1649 feature = "UIView"
1650))]
1651unsafe impl UISpringLoadedInteractionSupporting for UICollectionView {}
1652
1653extern_protocol!(
1654 pub unsafe trait UICollectionViewDragDelegate:
1656 NSObjectProtocol + MainThreadOnly
1657 {
1658 #[cfg(all(
1659 feature = "UIDragItem",
1660 feature = "UIDragSession",
1661 feature = "UIResponder",
1662 feature = "UIScrollView",
1663 feature = "UIView"
1664 ))]
1665 #[unsafe(method(collectionView:itemsForBeginningDragSession:atIndexPath:))]
1666 #[unsafe(method_family = none)]
1667 unsafe fn collectionView_itemsForBeginningDragSession_atIndexPath(
1668 &self,
1669 collection_view: &UICollectionView,
1670 session: &ProtocolObject<dyn UIDragSession>,
1671 index_path: &NSIndexPath,
1672 ) -> Retained<NSArray<UIDragItem>>;
1673
1674 #[cfg(all(
1675 feature = "UIDragItem",
1676 feature = "UIDragSession",
1677 feature = "UIResponder",
1678 feature = "UIScrollView",
1679 feature = "UIView",
1680 feature = "objc2-core-foundation"
1681 ))]
1682 #[optional]
1683 #[unsafe(method(collectionView:itemsForAddingToDragSession:atIndexPath:point:))]
1684 #[unsafe(method_family = none)]
1685 unsafe fn collectionView_itemsForAddingToDragSession_atIndexPath_point(
1686 &self,
1687 collection_view: &UICollectionView,
1688 session: &ProtocolObject<dyn UIDragSession>,
1689 index_path: &NSIndexPath,
1690 point: CGPoint,
1691 ) -> Retained<NSArray<UIDragItem>>;
1692
1693 #[cfg(all(
1694 feature = "UIDragPreviewParameters",
1695 feature = "UIPreviewParameters",
1696 feature = "UIResponder",
1697 feature = "UIScrollView",
1698 feature = "UIView"
1699 ))]
1700 #[optional]
1701 #[unsafe(method(collectionView:dragPreviewParametersForItemAtIndexPath:))]
1702 #[unsafe(method_family = none)]
1703 unsafe fn collectionView_dragPreviewParametersForItemAtIndexPath(
1704 &self,
1705 collection_view: &UICollectionView,
1706 index_path: &NSIndexPath,
1707 ) -> Option<Retained<UIDragPreviewParameters>>;
1708
1709 #[cfg(all(
1710 feature = "UIDragSession",
1711 feature = "UIResponder",
1712 feature = "UIScrollView",
1713 feature = "UIView"
1714 ))]
1715 #[optional]
1716 #[unsafe(method(collectionView:dragSessionWillBegin:))]
1717 #[unsafe(method_family = none)]
1718 unsafe fn collectionView_dragSessionWillBegin(
1719 &self,
1720 collection_view: &UICollectionView,
1721 session: &ProtocolObject<dyn UIDragSession>,
1722 );
1723
1724 #[cfg(all(
1725 feature = "UIDragSession",
1726 feature = "UIResponder",
1727 feature = "UIScrollView",
1728 feature = "UIView"
1729 ))]
1730 #[optional]
1731 #[unsafe(method(collectionView:dragSessionDidEnd:))]
1732 #[unsafe(method_family = none)]
1733 unsafe fn collectionView_dragSessionDidEnd(
1734 &self,
1735 collection_view: &UICollectionView,
1736 session: &ProtocolObject<dyn UIDragSession>,
1737 );
1738
1739 #[cfg(all(
1740 feature = "UIDragSession",
1741 feature = "UIResponder",
1742 feature = "UIScrollView",
1743 feature = "UIView"
1744 ))]
1745 #[optional]
1746 #[unsafe(method(collectionView:dragSessionAllowsMoveOperation:))]
1747 #[unsafe(method_family = none)]
1748 unsafe fn collectionView_dragSessionAllowsMoveOperation(
1749 &self,
1750 collection_view: &UICollectionView,
1751 session: &ProtocolObject<dyn UIDragSession>,
1752 ) -> bool;
1753
1754 #[cfg(all(
1755 feature = "UIDragSession",
1756 feature = "UIResponder",
1757 feature = "UIScrollView",
1758 feature = "UIView"
1759 ))]
1760 #[optional]
1761 #[unsafe(method(collectionView:dragSessionIsRestrictedToDraggingApplication:))]
1762 #[unsafe(method_family = none)]
1763 unsafe fn collectionView_dragSessionIsRestrictedToDraggingApplication(
1764 &self,
1765 collection_view: &UICollectionView,
1766 session: &ProtocolObject<dyn UIDragSession>,
1767 ) -> bool;
1768 }
1769);
1770
1771extern_protocol!(
1772 pub unsafe trait UICollectionViewDropDelegate:
1774 NSObjectProtocol + MainThreadOnly
1775 {
1776 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1777 #[unsafe(method(collectionView:performDropWithCoordinator:))]
1778 #[unsafe(method_family = none)]
1779 unsafe fn collectionView_performDropWithCoordinator(
1780 &self,
1781 collection_view: &UICollectionView,
1782 coordinator: &ProtocolObject<dyn UICollectionViewDropCoordinator>,
1783 );
1784
1785 #[cfg(all(
1786 feature = "UIDragSession",
1787 feature = "UIResponder",
1788 feature = "UIScrollView",
1789 feature = "UIView"
1790 ))]
1791 #[optional]
1792 #[unsafe(method(collectionView:canHandleDropSession:))]
1793 #[unsafe(method_family = none)]
1794 unsafe fn collectionView_canHandleDropSession(
1795 &self,
1796 collection_view: &UICollectionView,
1797 session: &ProtocolObject<dyn UIDropSession>,
1798 ) -> bool;
1799
1800 #[cfg(all(
1801 feature = "UIDragSession",
1802 feature = "UIResponder",
1803 feature = "UIScrollView",
1804 feature = "UIView"
1805 ))]
1806 #[optional]
1807 #[unsafe(method(collectionView:dropSessionDidEnter:))]
1808 #[unsafe(method_family = none)]
1809 unsafe fn collectionView_dropSessionDidEnter(
1810 &self,
1811 collection_view: &UICollectionView,
1812 session: &ProtocolObject<dyn UIDropSession>,
1813 );
1814
1815 #[cfg(all(
1816 feature = "UIDragSession",
1817 feature = "UIDropInteraction",
1818 feature = "UIResponder",
1819 feature = "UIScrollView",
1820 feature = "UIView"
1821 ))]
1822 #[optional]
1823 #[unsafe(method(collectionView:dropSessionDidUpdate:withDestinationIndexPath:))]
1824 #[unsafe(method_family = none)]
1825 unsafe fn collectionView_dropSessionDidUpdate_withDestinationIndexPath(
1826 &self,
1827 collection_view: &UICollectionView,
1828 session: &ProtocolObject<dyn UIDropSession>,
1829 destination_index_path: Option<&NSIndexPath>,
1830 ) -> Retained<UICollectionViewDropProposal>;
1831
1832 #[cfg(all(
1833 feature = "UIDragSession",
1834 feature = "UIResponder",
1835 feature = "UIScrollView",
1836 feature = "UIView"
1837 ))]
1838 #[optional]
1839 #[unsafe(method(collectionView:dropSessionDidExit:))]
1840 #[unsafe(method_family = none)]
1841 unsafe fn collectionView_dropSessionDidExit(
1842 &self,
1843 collection_view: &UICollectionView,
1844 session: &ProtocolObject<dyn UIDropSession>,
1845 );
1846
1847 #[cfg(all(
1848 feature = "UIDragSession",
1849 feature = "UIResponder",
1850 feature = "UIScrollView",
1851 feature = "UIView"
1852 ))]
1853 #[optional]
1854 #[unsafe(method(collectionView:dropSessionDidEnd:))]
1855 #[unsafe(method_family = none)]
1856 unsafe fn collectionView_dropSessionDidEnd(
1857 &self,
1858 collection_view: &UICollectionView,
1859 session: &ProtocolObject<dyn UIDropSession>,
1860 );
1861
1862 #[cfg(all(
1863 feature = "UIDragPreviewParameters",
1864 feature = "UIPreviewParameters",
1865 feature = "UIResponder",
1866 feature = "UIScrollView",
1867 feature = "UIView"
1868 ))]
1869 #[optional]
1870 #[unsafe(method(collectionView:dropPreviewParametersForItemAtIndexPath:))]
1871 #[unsafe(method_family = none)]
1872 unsafe fn collectionView_dropPreviewParametersForItemAtIndexPath(
1873 &self,
1874 collection_view: &UICollectionView,
1875 index_path: &NSIndexPath,
1876 ) -> Option<Retained<UIDragPreviewParameters>>;
1877 }
1878);
1879
1880#[repr(transparent)]
1883#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1884pub struct UICollectionViewDropIntent(pub NSInteger);
1885impl UICollectionViewDropIntent {
1886 #[doc(alias = "UICollectionViewDropIntentUnspecified")]
1887 pub const Unspecified: Self = Self(0);
1888 #[doc(alias = "UICollectionViewDropIntentInsertAtDestinationIndexPath")]
1889 pub const InsertAtDestinationIndexPath: Self = Self(1);
1890 #[doc(alias = "UICollectionViewDropIntentInsertIntoDestinationIndexPath")]
1891 pub const InsertIntoDestinationIndexPath: Self = Self(2);
1892}
1893
1894unsafe impl Encode for UICollectionViewDropIntent {
1895 const ENCODING: Encoding = NSInteger::ENCODING;
1896}
1897
1898unsafe impl RefEncode for UICollectionViewDropIntent {
1899 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1900}
1901
1902extern_class!(
1903 #[unsafe(super(UIDropProposal, NSObject))]
1905 #[thread_kind = MainThreadOnly]
1906 #[derive(Debug, PartialEq, Eq, Hash)]
1907 #[cfg(feature = "UIDropInteraction")]
1908 pub struct UICollectionViewDropProposal;
1909);
1910
1911#[cfg(feature = "UIDropInteraction")]
1912unsafe impl NSCopying for UICollectionViewDropProposal {}
1913
1914#[cfg(feature = "UIDropInteraction")]
1915unsafe impl CopyingHelper for UICollectionViewDropProposal {
1916 type Result = Self;
1917}
1918
1919#[cfg(feature = "UIDropInteraction")]
1920unsafe impl NSObjectProtocol for UICollectionViewDropProposal {}
1921
1922#[cfg(feature = "UIDropInteraction")]
1923impl UICollectionViewDropProposal {
1924 extern_methods!(
1925 #[unsafe(method(initWithDropOperation:intent:))]
1926 #[unsafe(method_family = init)]
1927 pub unsafe fn initWithDropOperation_intent(
1928 this: Allocated<Self>,
1929 operation: UIDropOperation,
1930 intent: UICollectionViewDropIntent,
1931 ) -> Retained<Self>;
1932
1933 #[unsafe(method(intent))]
1934 #[unsafe(method_family = none)]
1935 pub unsafe fn intent(&self) -> UICollectionViewDropIntent;
1936 );
1937}
1938
1939#[cfg(feature = "UIDropInteraction")]
1941impl UICollectionViewDropProposal {
1942 extern_methods!(
1943 #[unsafe(method(initWithDropOperation:))]
1944 #[unsafe(method_family = init)]
1945 pub unsafe fn initWithDropOperation(
1946 this: Allocated<Self>,
1947 operation: UIDropOperation,
1948 ) -> Retained<Self>;
1949
1950 #[unsafe(method(init))]
1951 #[unsafe(method_family = init)]
1952 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1953
1954 #[unsafe(method(new))]
1955 #[unsafe(method_family = new)]
1956 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1957 );
1958}
1959
1960extern_protocol!(
1961 pub unsafe trait UICollectionViewDropCoordinator:
1963 NSObjectProtocol + MainThreadOnly
1964 {
1965 #[unsafe(method(items))]
1966 #[unsafe(method_family = none)]
1967 unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UICollectionViewDropItem>>>;
1968
1969 #[unsafe(method(destinationIndexPath))]
1970 #[unsafe(method_family = none)]
1971 unsafe fn destinationIndexPath(&self) -> Option<Retained<NSIndexPath>>;
1972
1973 #[cfg(feature = "UIDropInteraction")]
1974 #[unsafe(method(proposal))]
1975 #[unsafe(method_family = none)]
1976 unsafe fn proposal(&self) -> Retained<UICollectionViewDropProposal>;
1977
1978 #[cfg(feature = "UIDragSession")]
1979 #[unsafe(method(session))]
1980 #[unsafe(method_family = none)]
1981 unsafe fn session(&self) -> Retained<ProtocolObject<dyn UIDropSession>>;
1982
1983 #[cfg(all(feature = "UIDragInteraction", feature = "UIDragItem"))]
1984 #[unsafe(method(dropItem:toPlaceholder:))]
1985 #[unsafe(method_family = none)]
1986 unsafe fn dropItem_toPlaceholder(
1987 &self,
1988 drag_item: &UIDragItem,
1989 placeholder: &UICollectionViewDropPlaceholder,
1990 ) -> Retained<ProtocolObject<dyn UICollectionViewDropPlaceholderContext>>;
1991
1992 #[cfg(all(feature = "UIDragInteraction", feature = "UIDragItem"))]
1993 #[unsafe(method(dropItem:toItemAtIndexPath:))]
1994 #[unsafe(method_family = none)]
1995 unsafe fn dropItem_toItemAtIndexPath(
1996 &self,
1997 drag_item: &UIDragItem,
1998 index_path: &NSIndexPath,
1999 ) -> Retained<ProtocolObject<dyn UIDragAnimating>>;
2000
2001 #[cfg(all(
2002 feature = "UIDragInteraction",
2003 feature = "UIDragItem",
2004 feature = "objc2-core-foundation"
2005 ))]
2006 #[unsafe(method(dropItem:intoItemAtIndexPath:rect:))]
2007 #[unsafe(method_family = none)]
2008 unsafe fn dropItem_intoItemAtIndexPath_rect(
2009 &self,
2010 drag_item: &UIDragItem,
2011 index_path: &NSIndexPath,
2012 rect: CGRect,
2013 ) -> Retained<ProtocolObject<dyn UIDragAnimating>>;
2014
2015 #[cfg(all(
2016 feature = "UIDragInteraction",
2017 feature = "UIDragItem",
2018 feature = "UITargetedDragPreview",
2019 feature = "UITargetedPreview"
2020 ))]
2021 #[unsafe(method(dropItem:toTarget:))]
2022 #[unsafe(method_family = none)]
2023 unsafe fn dropItem_toTarget(
2024 &self,
2025 drag_item: &UIDragItem,
2026 target: &UIDragPreviewTarget,
2027 ) -> Retained<ProtocolObject<dyn UIDragAnimating>>;
2028 }
2029);
2030
2031extern_class!(
2032 #[unsafe(super(NSObject))]
2034 #[thread_kind = MainThreadOnly]
2035 #[derive(Debug, PartialEq, Eq, Hash)]
2036 pub struct UICollectionViewPlaceholder;
2037);
2038
2039unsafe impl NSObjectProtocol for UICollectionViewPlaceholder {}
2040
2041impl UICollectionViewPlaceholder {
2042 extern_methods!(
2043 #[unsafe(method(initWithInsertionIndexPath:reuseIdentifier:))]
2044 #[unsafe(method_family = init)]
2045 pub unsafe fn initWithInsertionIndexPath_reuseIdentifier(
2046 this: Allocated<Self>,
2047 insertion_index_path: &NSIndexPath,
2048 reuse_identifier: &NSString,
2049 ) -> Retained<Self>;
2050
2051 #[unsafe(method(init))]
2052 #[unsafe(method_family = init)]
2053 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2054
2055 #[unsafe(method(new))]
2056 #[unsafe(method_family = new)]
2057 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
2058
2059 #[cfg(all(
2060 feature = "UICollectionViewCell",
2061 feature = "UIResponder",
2062 feature = "UIView",
2063 feature = "block2"
2064 ))]
2065 #[unsafe(method(cellUpdateHandler))]
2066 #[unsafe(method_family = none)]
2067 pub unsafe fn cellUpdateHandler(
2068 &self,
2069 ) -> *mut block2::Block<dyn Fn(NonNull<UICollectionViewCell>)>;
2070
2071 #[cfg(all(
2072 feature = "UICollectionViewCell",
2073 feature = "UIResponder",
2074 feature = "UIView",
2075 feature = "block2"
2076 ))]
2077 #[unsafe(method(setCellUpdateHandler:))]
2079 #[unsafe(method_family = none)]
2080 pub unsafe fn setCellUpdateHandler(
2081 &self,
2082 cell_update_handler: Option<&block2::Block<dyn Fn(NonNull<UICollectionViewCell>)>>,
2083 );
2084 );
2085}
2086
2087extern_class!(
2088 #[unsafe(super(UICollectionViewPlaceholder, NSObject))]
2090 #[thread_kind = MainThreadOnly]
2091 #[derive(Debug, PartialEq, Eq, Hash)]
2092 pub struct UICollectionViewDropPlaceholder;
2093);
2094
2095unsafe impl NSObjectProtocol for UICollectionViewDropPlaceholder {}
2096
2097impl UICollectionViewDropPlaceholder {
2098 extern_methods!(
2099 #[cfg(all(
2100 feature = "UICollectionViewCell",
2101 feature = "UIDragPreviewParameters",
2102 feature = "UIPreviewParameters",
2103 feature = "UIResponder",
2104 feature = "UIView",
2105 feature = "block2"
2106 ))]
2107 #[unsafe(method(previewParametersProvider))]
2108 #[unsafe(method_family = none)]
2109 pub unsafe fn previewParametersProvider(
2110 &self,
2111 ) -> *mut block2::Block<dyn Fn(NonNull<UICollectionViewCell>) -> *mut UIDragPreviewParameters>;
2112
2113 #[cfg(all(
2114 feature = "UICollectionViewCell",
2115 feature = "UIDragPreviewParameters",
2116 feature = "UIPreviewParameters",
2117 feature = "UIResponder",
2118 feature = "UIView",
2119 feature = "block2"
2120 ))]
2121 #[unsafe(method(setPreviewParametersProvider:))]
2123 #[unsafe(method_family = none)]
2124 pub unsafe fn setPreviewParametersProvider(
2125 &self,
2126 preview_parameters_provider: Option<
2127 &block2::Block<
2128 dyn Fn(NonNull<UICollectionViewCell>) -> *mut UIDragPreviewParameters,
2129 >,
2130 >,
2131 );
2132 );
2133}
2134
2135impl UICollectionViewDropPlaceholder {
2137 extern_methods!(
2138 #[unsafe(method(initWithInsertionIndexPath:reuseIdentifier:))]
2139 #[unsafe(method_family = init)]
2140 pub unsafe fn initWithInsertionIndexPath_reuseIdentifier(
2141 this: Allocated<Self>,
2142 insertion_index_path: &NSIndexPath,
2143 reuse_identifier: &NSString,
2144 ) -> Retained<Self>;
2145
2146 #[unsafe(method(init))]
2147 #[unsafe(method_family = init)]
2148 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2149
2150 #[unsafe(method(new))]
2151 #[unsafe(method_family = new)]
2152 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
2153 );
2154}
2155
2156extern_protocol!(
2157 pub unsafe trait UICollectionViewDropItem: NSObjectProtocol + MainThreadOnly {
2159 #[cfg(feature = "UIDragItem")]
2160 #[unsafe(method(dragItem))]
2161 #[unsafe(method_family = none)]
2162 unsafe fn dragItem(&self) -> Retained<UIDragItem>;
2163
2164 #[unsafe(method(sourceIndexPath))]
2165 #[unsafe(method_family = none)]
2166 unsafe fn sourceIndexPath(&self) -> Option<Retained<NSIndexPath>>;
2167
2168 #[cfg(feature = "objc2-core-foundation")]
2169 #[unsafe(method(previewSize))]
2170 #[unsafe(method_family = none)]
2171 unsafe fn previewSize(&self) -> CGSize;
2172 }
2173);
2174
2175extern_protocol!(
2176 #[cfg(feature = "UIDragInteraction")]
2178 pub unsafe trait UICollectionViewDropPlaceholderContext:
2179 UIDragAnimating + MainThreadOnly
2180 {
2181 #[cfg(feature = "UIDragItem")]
2182 #[unsafe(method(dragItem))]
2183 #[unsafe(method_family = none)]
2184 unsafe fn dragItem(&self) -> Retained<UIDragItem>;
2185
2186 #[cfg(feature = "block2")]
2187 #[unsafe(method(commitInsertionWithDataSourceUpdates:))]
2188 #[unsafe(method_family = none)]
2189 unsafe fn commitInsertionWithDataSourceUpdates(
2190 &self,
2191 data_source_updates: &block2::Block<dyn Fn(NonNull<NSIndexPath>) + '_>,
2192 ) -> bool;
2193
2194 #[unsafe(method(deletePlaceholder))]
2195 #[unsafe(method_family = none)]
2196 unsafe fn deletePlaceholder(&self) -> bool;
2197
2198 #[unsafe(method(setNeedsCellUpdate))]
2199 #[unsafe(method_family = none)]
2200 unsafe fn setNeedsCellUpdate(&self);
2201 }
2202);