1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 pub struct NSDiffableDataSourceSnapshot<
15 SectionIdentifierType: ?Sized = AnyObject,
16 ItemIdentifierType: ?Sized = AnyObject,
17 >;
18);
19
20extern_conformance!(
21 unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSCopying
22 for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
23 {
24 }
25);
26
27unsafe impl<SectionIdentifierType: ?Sized + Message, ItemIdentifierType: ?Sized + Message>
28 CopyingHelper for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
29{
30 type Result = Self;
31}
32
33extern_conformance!(
34 unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
35 for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
36 {
37 }
38);
39
40impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
41 NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
42{
43 extern_methods!(
44 #[unsafe(method(numberOfItems))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn numberOfItems(&self) -> NSInteger;
47
48 #[unsafe(method(numberOfSections))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn numberOfSections(&self) -> NSInteger;
51
52 #[unsafe(method(sectionIdentifiers))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn sectionIdentifiers(&self) -> Retained<NSArray<SectionIdentifierType>>;
55
56 #[unsafe(method(itemIdentifiers))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn itemIdentifiers(&self) -> Retained<NSArray<ItemIdentifierType>>;
59
60 #[unsafe(method(reloadedSectionIdentifiers))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn reloadedSectionIdentifiers(&self)
63 -> Retained<NSArray<SectionIdentifierType>>;
64
65 #[unsafe(method(reloadedItemIdentifiers))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn reloadedItemIdentifiers(&self) -> Retained<NSArray<ItemIdentifierType>>;
68
69 #[unsafe(method(reconfiguredItemIdentifiers))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn reconfiguredItemIdentifiers(&self) -> Retained<NSArray<ItemIdentifierType>>;
72
73 #[unsafe(method(numberOfItemsInSection:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn numberOfItemsInSection(
76 &self,
77 section_identifier: &SectionIdentifierType,
78 ) -> NSInteger;
79
80 #[unsafe(method(itemIdentifiersInSectionWithIdentifier:))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn itemIdentifiersInSectionWithIdentifier(
83 &self,
84 section_identifier: &SectionIdentifierType,
85 ) -> Retained<NSArray<ItemIdentifierType>>;
86
87 #[unsafe(method(sectionIdentifierForSectionContainingItemIdentifier:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn sectionIdentifierForSectionContainingItemIdentifier(
90 &self,
91 item_identifier: &ItemIdentifierType,
92 ) -> Option<Retained<SectionIdentifierType>>;
93
94 #[unsafe(method(indexOfItemIdentifier:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn indexOfItemIdentifier(
97 &self,
98 item_identifier: &ItemIdentifierType,
99 ) -> NSInteger;
100
101 #[unsafe(method(indexOfSectionIdentifier:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn indexOfSectionIdentifier(
104 &self,
105 section_identifier: &SectionIdentifierType,
106 ) -> NSInteger;
107
108 #[unsafe(method(appendItemsWithIdentifiers:))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn appendItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
111
112 #[unsafe(method(appendItemsWithIdentifiers:intoSectionWithIdentifier:))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn appendItemsWithIdentifiers_intoSectionWithIdentifier(
115 &self,
116 identifiers: &NSArray<ItemIdentifierType>,
117 section_identifier: &SectionIdentifierType,
118 );
119
120 #[unsafe(method(insertItemsWithIdentifiers:beforeItemWithIdentifier:))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn insertItemsWithIdentifiers_beforeItemWithIdentifier(
123 &self,
124 identifiers: &NSArray<ItemIdentifierType>,
125 item_identifier: &ItemIdentifierType,
126 );
127
128 #[unsafe(method(insertItemsWithIdentifiers:afterItemWithIdentifier:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn insertItemsWithIdentifiers_afterItemWithIdentifier(
131 &self,
132 identifiers: &NSArray<ItemIdentifierType>,
133 item_identifier: &ItemIdentifierType,
134 );
135
136 #[unsafe(method(deleteItemsWithIdentifiers:))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn deleteItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
139
140 #[unsafe(method(deleteAllItems))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn deleteAllItems(&self);
143
144 #[unsafe(method(moveItemWithIdentifier:beforeItemWithIdentifier:))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn moveItemWithIdentifier_beforeItemWithIdentifier(
147 &self,
148 from_identifier: &ItemIdentifierType,
149 to_identifier: &ItemIdentifierType,
150 );
151
152 #[unsafe(method(moveItemWithIdentifier:afterItemWithIdentifier:))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn moveItemWithIdentifier_afterItemWithIdentifier(
155 &self,
156 from_identifier: &ItemIdentifierType,
157 to_identifier: &ItemIdentifierType,
158 );
159
160 #[unsafe(method(reloadItemsWithIdentifiers:))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn reloadItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
163
164 #[unsafe(method(reconfigureItemsWithIdentifiers:))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn reconfigureItemsWithIdentifiers(
167 &self,
168 identifiers: &NSArray<ItemIdentifierType>,
169 );
170
171 #[unsafe(method(appendSectionsWithIdentifiers:))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn appendSectionsWithIdentifiers(
174 &self,
175 section_identifiers: &NSArray<SectionIdentifierType>,
176 );
177
178 #[unsafe(method(insertSectionsWithIdentifiers:beforeSectionWithIdentifier:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn insertSectionsWithIdentifiers_beforeSectionWithIdentifier(
181 &self,
182 section_identifiers: &NSArray<SectionIdentifierType>,
183 to_section_identifier: &SectionIdentifierType,
184 );
185
186 #[unsafe(method(insertSectionsWithIdentifiers:afterSectionWithIdentifier:))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn insertSectionsWithIdentifiers_afterSectionWithIdentifier(
189 &self,
190 section_identifiers: &NSArray<SectionIdentifierType>,
191 to_section_identifier: &SectionIdentifierType,
192 );
193
194 #[unsafe(method(deleteSectionsWithIdentifiers:))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn deleteSectionsWithIdentifiers(
197 &self,
198 section_identifiers: &NSArray<SectionIdentifierType>,
199 );
200
201 #[unsafe(method(moveSectionWithIdentifier:beforeSectionWithIdentifier:))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn moveSectionWithIdentifier_beforeSectionWithIdentifier(
204 &self,
205 from_section_identifier: &SectionIdentifierType,
206 to_section_identifier: &SectionIdentifierType,
207 );
208
209 #[unsafe(method(moveSectionWithIdentifier:afterSectionWithIdentifier:))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn moveSectionWithIdentifier_afterSectionWithIdentifier(
212 &self,
213 from_section_identifier: &SectionIdentifierType,
214 to_section_identifier: &SectionIdentifierType,
215 );
216
217 #[unsafe(method(reloadSectionsWithIdentifiers:))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn reloadSectionsWithIdentifiers(
220 &self,
221 section_identifiers: &NSArray<SectionIdentifierType>,
222 );
223 );
224}
225
226impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
228 NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
229{
230 extern_methods!(
231 #[unsafe(method(init))]
232 #[unsafe(method_family = init)]
233 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
234
235 #[unsafe(method(new))]
236 #[unsafe(method_family = new)]
237 pub unsafe fn new() -> Retained<Self>;
238 );
239}
240
241#[cfg(all(
243 feature = "UICollectionView",
244 feature = "UICollectionViewCell",
245 feature = "UIResponder",
246 feature = "UIScrollView",
247 feature = "UIView",
248 feature = "block2"
249))]
250pub type UICollectionViewDiffableDataSourceCellProvider = *mut block2::DynBlock<
251 dyn Fn(
252 NonNull<UICollectionView>,
253 NonNull<NSIndexPath>,
254 NonNull<AnyObject>,
255 ) -> *mut UICollectionViewCell,
256>;
257
258#[cfg(all(
260 feature = "UICollectionView",
261 feature = "UICollectionViewCell",
262 feature = "UIResponder",
263 feature = "UIScrollView",
264 feature = "UIView",
265 feature = "block2"
266))]
267pub type UICollectionViewDiffableDataSourceSupplementaryViewProvider = *mut block2::DynBlock<
268 dyn Fn(
269 NonNull<UICollectionView>,
270 NonNull<NSString>,
271 NonNull<NSIndexPath>,
272 ) -> *mut UICollectionReusableView,
273>;
274
275extern_class!(
276 #[unsafe(super(NSObject))]
278 #[derive(Debug, PartialEq, Eq, Hash)]
279 pub struct NSDiffableDataSourceSectionTransaction<
280 SectionIdentifierType: ?Sized = AnyObject,
281 ItemIdentifierType: ?Sized = AnyObject,
282 >;
283);
284
285extern_conformance!(
286 unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
287 for NSDiffableDataSourceSectionTransaction<SectionIdentifierType, ItemIdentifierType>
288 {
289 }
290);
291
292impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
293 NSDiffableDataSourceSectionTransaction<SectionIdentifierType, ItemIdentifierType>
294{
295 extern_methods!(
296 #[unsafe(method(sectionIdentifier))]
297 #[unsafe(method_family = none)]
298 pub unsafe fn sectionIdentifier(&self) -> Retained<SectionIdentifierType>;
299
300 #[cfg(feature = "NSDiffableDataSourceSectionSnapshot")]
301 #[unsafe(method(initialSnapshot))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn initialSnapshot(
304 &self,
305 ) -> Retained<NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>>;
306
307 #[cfg(feature = "NSDiffableDataSourceSectionSnapshot")]
308 #[unsafe(method(finalSnapshot))]
309 #[unsafe(method_family = none)]
310 pub unsafe fn finalSnapshot(
311 &self,
312 ) -> Retained<NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>>;
313
314 #[unsafe(method(difference))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn difference(
317 &self,
318 ) -> Retained<NSOrderedCollectionDifference<ItemIdentifierType>>;
319 );
320}
321
322impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
324 NSDiffableDataSourceSectionTransaction<SectionIdentifierType, ItemIdentifierType>
325{
326 extern_methods!(
327 #[unsafe(method(init))]
328 #[unsafe(method_family = init)]
329 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
330
331 #[unsafe(method(new))]
332 #[unsafe(method_family = new)]
333 pub unsafe fn new() -> Retained<Self>;
334 );
335}
336
337extern_class!(
338 #[unsafe(super(NSObject))]
340 #[derive(Debug, PartialEq, Eq, Hash)]
341 pub struct NSDiffableDataSourceTransaction<
342 SectionIdentifierType: ?Sized = AnyObject,
343 ItemIdentifierType: ?Sized = AnyObject,
344 >;
345);
346
347extern_conformance!(
348 unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
349 for NSDiffableDataSourceTransaction<SectionIdentifierType, ItemIdentifierType>
350 {
351 }
352);
353
354impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
355 NSDiffableDataSourceTransaction<SectionIdentifierType, ItemIdentifierType>
356{
357 extern_methods!(
358 #[unsafe(method(initialSnapshot))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn initialSnapshot(
361 &self,
362 ) -> Retained<NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>>;
363
364 #[unsafe(method(finalSnapshot))]
365 #[unsafe(method_family = none)]
366 pub unsafe fn finalSnapshot(
367 &self,
368 ) -> Retained<NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>>;
369
370 #[unsafe(method(difference))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn difference(
373 &self,
374 ) -> Retained<NSOrderedCollectionDifference<ItemIdentifierType>>;
375
376 #[unsafe(method(sectionTransactions))]
377 #[unsafe(method_family = none)]
378 pub unsafe fn sectionTransactions(
379 &self,
380 ) -> Retained<
381 NSArray<
382 NSDiffableDataSourceSectionTransaction<SectionIdentifierType, ItemIdentifierType>,
383 >,
384 >;
385 );
386}
387
388impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
390 NSDiffableDataSourceTransaction<SectionIdentifierType, ItemIdentifierType>
391{
392 extern_methods!(
393 #[unsafe(method(init))]
394 #[unsafe(method_family = init)]
395 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
396
397 #[unsafe(method(new))]
398 #[unsafe(method_family = new)]
399 pub unsafe fn new() -> Retained<Self>;
400 );
401}
402
403extern_class!(
404 #[unsafe(super(NSObject))]
406 #[thread_kind = MainThreadOnly]
407 #[derive(Debug, PartialEq, Eq, Hash)]
408 pub struct UICollectionViewDiffableDataSourceReorderingHandlers<
409 SectionType: ?Sized = AnyObject,
410 ItemType: ?Sized = AnyObject,
411 >;
412);
413
414extern_conformance!(
415 unsafe impl<SectionType: ?Sized, ItemType: ?Sized> NSCopying
416 for UICollectionViewDiffableDataSourceReorderingHandlers<SectionType, ItemType>
417 {
418 }
419);
420
421unsafe impl<SectionType: ?Sized + Message, ItemType: ?Sized + Message> CopyingHelper
422 for UICollectionViewDiffableDataSourceReorderingHandlers<SectionType, ItemType>
423{
424 type Result = Self;
425}
426
427extern_conformance!(
428 unsafe impl<SectionType: ?Sized, ItemType: ?Sized> NSObjectProtocol
429 for UICollectionViewDiffableDataSourceReorderingHandlers<SectionType, ItemType>
430 {
431 }
432);
433
434impl<SectionType: Message, ItemType: Message>
435 UICollectionViewDiffableDataSourceReorderingHandlers<SectionType, ItemType>
436{
437 extern_methods!(
438 #[cfg(feature = "block2")]
439 #[unsafe(method(canReorderItemHandler))]
440 #[unsafe(method_family = none)]
441 pub unsafe fn canReorderItemHandler(
442 &self,
443 ) -> *mut block2::DynBlock<dyn Fn(NonNull<ItemType>) -> Bool>;
444
445 #[cfg(feature = "block2")]
446 #[unsafe(method(setCanReorderItemHandler:))]
448 #[unsafe(method_family = none)]
449 pub unsafe fn setCanReorderItemHandler(
450 &self,
451 can_reorder_item_handler: Option<&block2::DynBlock<dyn Fn(NonNull<ItemType>) -> Bool>>,
452 );
453
454 #[cfg(feature = "block2")]
455 #[unsafe(method(willReorderHandler))]
456 #[unsafe(method_family = none)]
457 pub unsafe fn willReorderHandler(
458 &self,
459 ) -> *mut block2::DynBlock<
460 dyn Fn(NonNull<NSDiffableDataSourceTransaction<SectionType, ItemType>>),
461 >;
462
463 #[cfg(feature = "block2")]
464 #[unsafe(method(setWillReorderHandler:))]
466 #[unsafe(method_family = none)]
467 pub unsafe fn setWillReorderHandler(
468 &self,
469 will_reorder_handler: Option<
470 &block2::DynBlock<
471 dyn Fn(NonNull<NSDiffableDataSourceTransaction<SectionType, ItemType>>),
472 >,
473 >,
474 );
475
476 #[cfg(feature = "block2")]
477 #[unsafe(method(didReorderHandler))]
478 #[unsafe(method_family = none)]
479 pub unsafe fn didReorderHandler(
480 &self,
481 ) -> *mut block2::DynBlock<
482 dyn Fn(NonNull<NSDiffableDataSourceTransaction<SectionType, ItemType>>),
483 >;
484
485 #[cfg(feature = "block2")]
486 #[unsafe(method(setDidReorderHandler:))]
488 #[unsafe(method_family = none)]
489 pub unsafe fn setDidReorderHandler(
490 &self,
491 did_reorder_handler: Option<
492 &block2::DynBlock<
493 dyn Fn(NonNull<NSDiffableDataSourceTransaction<SectionType, ItemType>>),
494 >,
495 >,
496 );
497 );
498}
499
500impl<SectionType: Message, ItemType: Message>
502 UICollectionViewDiffableDataSourceReorderingHandlers<SectionType, ItemType>
503{
504 extern_methods!(
505 #[unsafe(method(init))]
506 #[unsafe(method_family = init)]
507 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
508
509 #[unsafe(method(new))]
510 #[unsafe(method_family = new)]
511 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
512 );
513}
514
515extern_class!(
516 #[unsafe(super(NSObject))]
518 #[thread_kind = MainThreadOnly]
519 #[derive(Debug, PartialEq, Eq, Hash)]
520 pub struct UICollectionViewDiffableDataSourceSectionSnapshotHandlers<
521 ItemType: ?Sized = AnyObject,
522 >;
523);
524
525extern_conformance!(
526 unsafe impl<ItemType: ?Sized> NSCopying
527 for UICollectionViewDiffableDataSourceSectionSnapshotHandlers<ItemType>
528 {
529 }
530);
531
532unsafe impl<ItemType: ?Sized + Message> CopyingHelper
533 for UICollectionViewDiffableDataSourceSectionSnapshotHandlers<ItemType>
534{
535 type Result = Self;
536}
537
538extern_conformance!(
539 unsafe impl<ItemType: ?Sized> NSObjectProtocol
540 for UICollectionViewDiffableDataSourceSectionSnapshotHandlers<ItemType>
541 {
542 }
543);
544
545impl<ItemType: Message> UICollectionViewDiffableDataSourceSectionSnapshotHandlers<ItemType> {
546 extern_methods!(
547 #[cfg(feature = "block2")]
548 #[unsafe(method(shouldExpandItemHandler))]
549 #[unsafe(method_family = none)]
550 pub unsafe fn shouldExpandItemHandler(
551 &self,
552 ) -> *mut block2::DynBlock<dyn Fn(NonNull<ItemType>) -> Bool>;
553
554 #[cfg(feature = "block2")]
555 #[unsafe(method(setShouldExpandItemHandler:))]
557 #[unsafe(method_family = none)]
558 pub unsafe fn setShouldExpandItemHandler(
559 &self,
560 should_expand_item_handler: Option<
561 &block2::DynBlock<dyn Fn(NonNull<ItemType>) -> Bool>,
562 >,
563 );
564
565 #[cfg(feature = "block2")]
566 #[unsafe(method(willExpandItemHandler))]
567 #[unsafe(method_family = none)]
568 pub unsafe fn willExpandItemHandler(
569 &self,
570 ) -> *mut block2::DynBlock<dyn Fn(NonNull<ItemType>)>;
571
572 #[cfg(feature = "block2")]
573 #[unsafe(method(setWillExpandItemHandler:))]
575 #[unsafe(method_family = none)]
576 pub unsafe fn setWillExpandItemHandler(
577 &self,
578 will_expand_item_handler: Option<&block2::DynBlock<dyn Fn(NonNull<ItemType>)>>,
579 );
580
581 #[cfg(feature = "block2")]
582 #[unsafe(method(shouldCollapseItemHandler))]
583 #[unsafe(method_family = none)]
584 pub unsafe fn shouldCollapseItemHandler(
585 &self,
586 ) -> *mut block2::DynBlock<dyn Fn(NonNull<ItemType>) -> Bool>;
587
588 #[cfg(feature = "block2")]
589 #[unsafe(method(setShouldCollapseItemHandler:))]
591 #[unsafe(method_family = none)]
592 pub unsafe fn setShouldCollapseItemHandler(
593 &self,
594 should_collapse_item_handler: Option<
595 &block2::DynBlock<dyn Fn(NonNull<ItemType>) -> Bool>,
596 >,
597 );
598
599 #[cfg(feature = "block2")]
600 #[unsafe(method(willCollapseItemHandler))]
601 #[unsafe(method_family = none)]
602 pub unsafe fn willCollapseItemHandler(
603 &self,
604 ) -> *mut block2::DynBlock<dyn Fn(NonNull<ItemType>)>;
605
606 #[cfg(feature = "block2")]
607 #[unsafe(method(setWillCollapseItemHandler:))]
609 #[unsafe(method_family = none)]
610 pub unsafe fn setWillCollapseItemHandler(
611 &self,
612 will_collapse_item_handler: Option<&block2::DynBlock<dyn Fn(NonNull<ItemType>)>>,
613 );
614
615 #[cfg(all(feature = "NSDiffableDataSourceSectionSnapshot", feature = "block2"))]
616 #[unsafe(method(snapshotForExpandingParentItemHandler))]
617 #[unsafe(method_family = none)]
618 pub unsafe fn snapshotForExpandingParentItemHandler(
619 &self,
620 ) -> *mut block2::DynBlock<
621 dyn Fn(
622 NonNull<ItemType>,
623 NonNull<NSDiffableDataSourceSectionSnapshot<ItemType>>,
624 ) -> NonNull<NSDiffableDataSourceSectionSnapshot<ItemType>>,
625 >;
626
627 #[cfg(all(feature = "NSDiffableDataSourceSectionSnapshot", feature = "block2"))]
628 #[unsafe(method(setSnapshotForExpandingParentItemHandler:))]
630 #[unsafe(method_family = none)]
631 pub unsafe fn setSnapshotForExpandingParentItemHandler(
632 &self,
633 snapshot_for_expanding_parent_item_handler: Option<
634 &block2::DynBlock<
635 dyn Fn(
636 NonNull<ItemType>,
637 NonNull<NSDiffableDataSourceSectionSnapshot<ItemType>>,
638 )
639 -> NonNull<NSDiffableDataSourceSectionSnapshot<ItemType>>,
640 >,
641 >,
642 );
643 );
644}
645
646impl<ItemType: Message> UICollectionViewDiffableDataSourceSectionSnapshotHandlers<ItemType> {
648 extern_methods!(
649 #[unsafe(method(init))]
650 #[unsafe(method_family = init)]
651 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
652
653 #[unsafe(method(new))]
654 #[unsafe(method_family = new)]
655 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
656 );
657}
658
659extern_class!(
660 #[unsafe(super(NSObject))]
662 #[thread_kind = MainThreadOnly]
663 #[derive(Debug, PartialEq, Eq, Hash)]
664 pub struct UICollectionViewDiffableDataSource<
665 SectionIdentifierType: ?Sized = AnyObject,
666 ItemIdentifierType: ?Sized = AnyObject,
667 >;
668);
669
670extern_conformance!(
671 unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
672 for UICollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
673 {
674 }
675);
676
677#[cfg(feature = "UICollectionView")]
678extern_conformance!(
679 unsafe impl<SectionIdentifierType: ?Sized + Message, ItemIdentifierType: ?Sized + Message>
680 UICollectionViewDataSource
681 for UICollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
682 {
683 }
684);
685
686impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
687 UICollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
688{
689 extern_methods!(
690 #[cfg(all(
691 feature = "UICollectionView",
692 feature = "UICollectionViewCell",
693 feature = "UIResponder",
694 feature = "UIScrollView",
695 feature = "UIView",
696 feature = "block2"
697 ))]
698 #[unsafe(method(initWithCollectionView:cellProvider:))]
699 #[unsafe(method_family = init)]
700 pub unsafe fn initWithCollectionView_cellProvider(
701 this: Allocated<Self>,
702 collection_view: &UICollectionView,
703 cell_provider: UICollectionViewDiffableDataSourceCellProvider,
704 ) -> Retained<Self>;
705
706 #[unsafe(method(init))]
707 #[unsafe(method_family = init)]
708 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
709
710 #[unsafe(method(new))]
711 #[unsafe(method_family = new)]
712 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
713
714 #[cfg(all(
715 feature = "UICollectionView",
716 feature = "UICollectionViewCell",
717 feature = "UIResponder",
718 feature = "UIScrollView",
719 feature = "UIView",
720 feature = "block2"
721 ))]
722 #[unsafe(method(supplementaryViewProvider))]
723 #[unsafe(method_family = none)]
724 pub unsafe fn supplementaryViewProvider(
725 &self,
726 ) -> UICollectionViewDiffableDataSourceSupplementaryViewProvider;
727
728 #[cfg(all(
729 feature = "UICollectionView",
730 feature = "UICollectionViewCell",
731 feature = "UIResponder",
732 feature = "UIScrollView",
733 feature = "UIView",
734 feature = "block2"
735 ))]
736 #[unsafe(method(setSupplementaryViewProvider:))]
738 #[unsafe(method_family = none)]
739 pub unsafe fn setSupplementaryViewProvider(
740 &self,
741 supplementary_view_provider: UICollectionViewDiffableDataSourceSupplementaryViewProvider,
742 );
743
744 #[unsafe(method(snapshot))]
745 #[unsafe(method_family = none)]
746 pub unsafe fn snapshot(
747 &self,
748 ) -> Retained<NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>>;
749
750 #[unsafe(method(applySnapshot:animatingDifferences:))]
751 #[unsafe(method_family = none)]
752 pub unsafe fn applySnapshot_animatingDifferences(
753 &self,
754 snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
755 animating_differences: bool,
756 );
757
758 #[cfg(feature = "block2")]
759 #[unsafe(method(applySnapshot:animatingDifferences:completion:))]
760 #[unsafe(method_family = none)]
761 pub unsafe fn applySnapshot_animatingDifferences_completion(
762 &self,
763 snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
764 animating_differences: bool,
765 completion: Option<&block2::DynBlock<dyn Fn()>>,
766 );
767
768 #[unsafe(method(applySnapshotUsingReloadData:))]
769 #[unsafe(method_family = none)]
770 pub unsafe fn applySnapshotUsingReloadData(
771 &self,
772 snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
773 );
774
775 #[cfg(feature = "block2")]
776 #[unsafe(method(applySnapshotUsingReloadData:completion:))]
777 #[unsafe(method_family = none)]
778 pub unsafe fn applySnapshotUsingReloadData_completion(
779 &self,
780 snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
781 completion: Option<&block2::DynBlock<dyn Fn()>>,
782 );
783
784 #[unsafe(method(sectionIdentifierForIndex:))]
785 #[unsafe(method_family = none)]
786 pub unsafe fn sectionIdentifierForIndex(
787 &self,
788 index: NSInteger,
789 ) -> Option<Retained<SectionIdentifierType>>;
790
791 #[unsafe(method(indexForSectionIdentifier:))]
792 #[unsafe(method_family = none)]
793 pub unsafe fn indexForSectionIdentifier(
794 &self,
795 identifier: &SectionIdentifierType,
796 ) -> NSInteger;
797
798 #[unsafe(method(itemIdentifierForIndexPath:))]
799 #[unsafe(method_family = none)]
800 pub unsafe fn itemIdentifierForIndexPath(
801 &self,
802 index_path: &NSIndexPath,
803 ) -> Option<Retained<ItemIdentifierType>>;
804
805 #[unsafe(method(indexPathForItemIdentifier:))]
806 #[unsafe(method_family = none)]
807 pub unsafe fn indexPathForItemIdentifier(
808 &self,
809 identifier: &ItemIdentifierType,
810 ) -> Option<Retained<NSIndexPath>>;
811
812 #[unsafe(method(reorderingHandlers))]
813 #[unsafe(method_family = none)]
814 pub unsafe fn reorderingHandlers(
815 &self,
816 ) -> Retained<
817 UICollectionViewDiffableDataSourceReorderingHandlers<
818 SectionIdentifierType,
819 ItemIdentifierType,
820 >,
821 >;
822
823 #[unsafe(method(setReorderingHandlers:))]
825 #[unsafe(method_family = none)]
826 pub unsafe fn setReorderingHandlers(
827 &self,
828 reordering_handlers: &UICollectionViewDiffableDataSourceReorderingHandlers<
829 SectionIdentifierType,
830 ItemIdentifierType,
831 >,
832 );
833
834 #[cfg(feature = "NSDiffableDataSourceSectionSnapshot")]
835 #[unsafe(method(applySnapshot:toSection:animatingDifferences:))]
836 #[unsafe(method_family = none)]
837 pub unsafe fn applySnapshot_toSection_animatingDifferences(
838 &self,
839 snapshot: &NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>,
840 section_identifier: &SectionIdentifierType,
841 animating_differences: bool,
842 );
843
844 #[cfg(all(feature = "NSDiffableDataSourceSectionSnapshot", feature = "block2"))]
845 #[unsafe(method(applySnapshot:toSection:animatingDifferences:completion:))]
846 #[unsafe(method_family = none)]
847 pub unsafe fn applySnapshot_toSection_animatingDifferences_completion(
848 &self,
849 snapshot: &NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>,
850 section_identifier: &SectionIdentifierType,
851 animating_differences: bool,
852 completion: Option<&block2::DynBlock<dyn Fn()>>,
853 );
854
855 #[cfg(feature = "NSDiffableDataSourceSectionSnapshot")]
856 #[unsafe(method(snapshotForSection:))]
857 #[unsafe(method_family = none)]
858 pub unsafe fn snapshotForSection(
859 &self,
860 section: &SectionIdentifierType,
861 ) -> Retained<NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>>;
862
863 #[unsafe(method(sectionSnapshotHandlers))]
864 #[unsafe(method_family = none)]
865 pub unsafe fn sectionSnapshotHandlers(
866 &self,
867 ) -> Retained<UICollectionViewDiffableDataSourceSectionSnapshotHandlers<ItemIdentifierType>>;
868
869 #[unsafe(method(setSectionSnapshotHandlers:))]
871 #[unsafe(method_family = none)]
872 pub unsafe fn setSectionSnapshotHandlers(
873 &self,
874 section_snapshot_handlers: &UICollectionViewDiffableDataSourceSectionSnapshotHandlers<
875 ItemIdentifierType,
876 >,
877 );
878 );
879}
880
881#[cfg(all(
883 feature = "UIResponder",
884 feature = "UIScrollView",
885 feature = "UITableView",
886 feature = "UITableViewCell",
887 feature = "UIView",
888 feature = "block2"
889))]
890pub type UITableViewDiffableDataSourceCellProvider = *mut block2::DynBlock<
891 dyn Fn(NonNull<UITableView>, NonNull<NSIndexPath>, NonNull<AnyObject>) -> *mut UITableViewCell,
892>;
893
894extern_class!(
895 #[unsafe(super(NSObject))]
897 #[thread_kind = MainThreadOnly]
898 #[derive(Debug, PartialEq, Eq, Hash)]
899 pub struct UITableViewDiffableDataSource<
900 SectionIdentifierType: ?Sized = AnyObject,
901 ItemIdentifierType: ?Sized = AnyObject,
902 >;
903);
904
905extern_conformance!(
906 unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
907 for UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
908 {
909 }
910);
911
912#[cfg(feature = "UITableView")]
913extern_conformance!(
914 unsafe impl<SectionIdentifierType: ?Sized + Message, ItemIdentifierType: ?Sized + Message>
915 UITableViewDataSource
916 for UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
917 {
918 }
919);
920
921impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
922 UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
923{
924 extern_methods!(
925 #[cfg(all(
926 feature = "UIResponder",
927 feature = "UIScrollView",
928 feature = "UITableView",
929 feature = "UITableViewCell",
930 feature = "UIView",
931 feature = "block2"
932 ))]
933 #[unsafe(method(initWithTableView:cellProvider:))]
934 #[unsafe(method_family = init)]
935 pub unsafe fn initWithTableView_cellProvider(
936 this: Allocated<Self>,
937 table_view: &UITableView,
938 cell_provider: UITableViewDiffableDataSourceCellProvider,
939 ) -> Retained<Self>;
940
941 #[unsafe(method(init))]
942 #[unsafe(method_family = init)]
943 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
944
945 #[unsafe(method(new))]
946 #[unsafe(method_family = new)]
947 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
948
949 #[unsafe(method(snapshot))]
950 #[unsafe(method_family = none)]
951 pub unsafe fn snapshot(
952 &self,
953 ) -> Retained<NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>>;
954
955 #[unsafe(method(applySnapshot:animatingDifferences:))]
956 #[unsafe(method_family = none)]
957 pub unsafe fn applySnapshot_animatingDifferences(
958 &self,
959 snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
960 animating_differences: bool,
961 );
962
963 #[cfg(feature = "block2")]
964 #[unsafe(method(applySnapshot:animatingDifferences:completion:))]
965 #[unsafe(method_family = none)]
966 pub unsafe fn applySnapshot_animatingDifferences_completion(
967 &self,
968 snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
969 animating_differences: bool,
970 completion: Option<&block2::DynBlock<dyn Fn()>>,
971 );
972
973 #[unsafe(method(applySnapshotUsingReloadData:))]
974 #[unsafe(method_family = none)]
975 pub unsafe fn applySnapshotUsingReloadData(
976 &self,
977 snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
978 );
979
980 #[cfg(feature = "block2")]
981 #[unsafe(method(applySnapshotUsingReloadData:completion:))]
982 #[unsafe(method_family = none)]
983 pub unsafe fn applySnapshotUsingReloadData_completion(
984 &self,
985 snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
986 completion: Option<&block2::DynBlock<dyn Fn()>>,
987 );
988
989 #[unsafe(method(sectionIdentifierForIndex:))]
990 #[unsafe(method_family = none)]
991 pub unsafe fn sectionIdentifierForIndex(
992 &self,
993 index: NSInteger,
994 ) -> Option<Retained<SectionIdentifierType>>;
995
996 #[unsafe(method(indexForSectionIdentifier:))]
997 #[unsafe(method_family = none)]
998 pub unsafe fn indexForSectionIdentifier(
999 &self,
1000 identifier: &SectionIdentifierType,
1001 ) -> NSInteger;
1002
1003 #[unsafe(method(itemIdentifierForIndexPath:))]
1004 #[unsafe(method_family = none)]
1005 pub unsafe fn itemIdentifierForIndexPath(
1006 &self,
1007 index_path: &NSIndexPath,
1008 ) -> Option<Retained<ItemIdentifierType>>;
1009
1010 #[unsafe(method(indexPathForItemIdentifier:))]
1011 #[unsafe(method_family = none)]
1012 pub unsafe fn indexPathForItemIdentifier(
1013 &self,
1014 identifier: &ItemIdentifierType,
1015 ) -> Option<Retained<NSIndexPath>>;
1016
1017 #[cfg(feature = "UITableView")]
1018 #[unsafe(method(defaultRowAnimation))]
1019 #[unsafe(method_family = none)]
1020 pub unsafe fn defaultRowAnimation(&self) -> UITableViewRowAnimation;
1021
1022 #[cfg(feature = "UITableView")]
1023 #[unsafe(method(setDefaultRowAnimation:))]
1025 #[unsafe(method_family = none)]
1026 pub unsafe fn setDefaultRowAnimation(&self, default_row_animation: UITableViewRowAnimation);
1027 );
1028}