objc2_ui_kit/generated/
UIDiffableDataSource.rs

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