objc2_ui_kit/generated/
UICollectionViewCompositionalLayout.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicontentinsetsreference?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UIContentInsetsReference(pub NSInteger);
20impl UIContentInsetsReference {
21    #[doc(alias = "UIContentInsetsReferenceAutomatic")]
22    pub const Automatic: Self = Self(0);
23    #[doc(alias = "UIContentInsetsReferenceNone")]
24    pub const None: Self = Self(1);
25    #[doc(alias = "UIContentInsetsReferenceSafeArea")]
26    pub const SafeArea: Self = Self(2);
27    #[doc(alias = "UIContentInsetsReferenceLayoutMargins")]
28    pub const LayoutMargins: Self = Self(3);
29    #[doc(alias = "UIContentInsetsReferenceReadableContent")]
30    pub const ReadableContent: Self = Self(4);
31}
32
33unsafe impl Encode for UIContentInsetsReference {
34    const ENCODING: Encoding = NSInteger::ENCODING;
35}
36
37unsafe impl RefEncode for UIContentInsetsReference {
38    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41extern_class!(
42    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewcompositionallayoutconfiguration?language=objc)
43    #[unsafe(super(NSObject))]
44    #[thread_kind = MainThreadOnly]
45    #[derive(Debug, PartialEq, Eq, Hash)]
46    pub struct UICollectionViewCompositionalLayoutConfiguration;
47);
48
49unsafe impl NSCopying for UICollectionViewCompositionalLayoutConfiguration {}
50
51unsafe impl CopyingHelper for UICollectionViewCompositionalLayoutConfiguration {
52    type Result = Self;
53}
54
55unsafe impl NSObjectProtocol for UICollectionViewCompositionalLayoutConfiguration {}
56
57impl UICollectionViewCompositionalLayoutConfiguration {
58    extern_methods!(
59        #[cfg(feature = "UICollectionViewLayout")]
60        #[unsafe(method(scrollDirection))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn scrollDirection(&self) -> UICollectionViewScrollDirection;
63
64        #[cfg(feature = "UICollectionViewLayout")]
65        /// Setter for [`scrollDirection`][Self::scrollDirection].
66        #[unsafe(method(setScrollDirection:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setScrollDirection(&self, scroll_direction: UICollectionViewScrollDirection);
69
70        #[cfg(feature = "objc2-core-foundation")]
71        #[unsafe(method(interSectionSpacing))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn interSectionSpacing(&self) -> CGFloat;
74
75        #[cfg(feature = "objc2-core-foundation")]
76        /// Setter for [`interSectionSpacing`][Self::interSectionSpacing].
77        #[unsafe(method(setInterSectionSpacing:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setInterSectionSpacing(&self, inter_section_spacing: CGFloat);
80
81        #[unsafe(method(boundarySupplementaryItems))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn boundarySupplementaryItems(
84            &self,
85        ) -> Retained<NSArray<NSCollectionLayoutBoundarySupplementaryItem>>;
86
87        /// Setter for [`boundarySupplementaryItems`][Self::boundarySupplementaryItems].
88        #[unsafe(method(setBoundarySupplementaryItems:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setBoundarySupplementaryItems(
91            &self,
92            boundary_supplementary_items: &NSArray<NSCollectionLayoutBoundarySupplementaryItem>,
93        );
94
95        #[unsafe(method(contentInsetsReference))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn contentInsetsReference(&self) -> UIContentInsetsReference;
98
99        /// Setter for [`contentInsetsReference`][Self::contentInsetsReference].
100        #[unsafe(method(setContentInsetsReference:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setContentInsetsReference(
103            &self,
104            content_insets_reference: UIContentInsetsReference,
105        );
106    );
107}
108
109/// Methods declared on superclass `NSObject`.
110impl UICollectionViewCompositionalLayoutConfiguration {
111    extern_methods!(
112        #[unsafe(method(init))]
113        #[unsafe(method_family = init)]
114        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
115
116        #[unsafe(method(new))]
117        #[unsafe(method_family = new)]
118        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
119    );
120}
121
122/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewcompositionallayoutsectionprovider?language=objc)
123#[cfg(feature = "block2")]
124pub type UICollectionViewCompositionalLayoutSectionProvider = *mut block2::Block<
125    dyn Fn(
126        NSInteger,
127        NonNull<ProtocolObject<dyn NSCollectionLayoutEnvironment>>,
128    ) -> *mut NSCollectionLayoutSection,
129>;
130
131extern_class!(
132    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewcompositionallayout?language=objc)
133    #[unsafe(super(UICollectionViewLayout, NSObject))]
134    #[thread_kind = MainThreadOnly]
135    #[derive(Debug, PartialEq, Eq, Hash)]
136    #[cfg(feature = "UICollectionViewLayout")]
137    pub struct UICollectionViewCompositionalLayout;
138);
139
140#[cfg(feature = "UICollectionViewLayout")]
141unsafe impl NSCoding for UICollectionViewCompositionalLayout {}
142
143#[cfg(feature = "UICollectionViewLayout")]
144unsafe impl NSObjectProtocol for UICollectionViewCompositionalLayout {}
145
146#[cfg(feature = "UICollectionViewLayout")]
147impl UICollectionViewCompositionalLayout {
148    extern_methods!(
149        #[unsafe(method(initWithSection:))]
150        #[unsafe(method_family = init)]
151        pub unsafe fn initWithSection(
152            this: Allocated<Self>,
153            section: &NSCollectionLayoutSection,
154        ) -> Retained<Self>;
155
156        #[unsafe(method(initWithSection:configuration:))]
157        #[unsafe(method_family = init)]
158        pub unsafe fn initWithSection_configuration(
159            this: Allocated<Self>,
160            section: &NSCollectionLayoutSection,
161            configuration: &UICollectionViewCompositionalLayoutConfiguration,
162        ) -> Retained<Self>;
163
164        #[cfg(feature = "block2")]
165        #[unsafe(method(initWithSectionProvider:))]
166        #[unsafe(method_family = init)]
167        pub unsafe fn initWithSectionProvider(
168            this: Allocated<Self>,
169            section_provider: UICollectionViewCompositionalLayoutSectionProvider,
170        ) -> Retained<Self>;
171
172        #[cfg(feature = "block2")]
173        #[unsafe(method(initWithSectionProvider:configuration:))]
174        #[unsafe(method_family = init)]
175        pub unsafe fn initWithSectionProvider_configuration(
176            this: Allocated<Self>,
177            section_provider: UICollectionViewCompositionalLayoutSectionProvider,
178            configuration: &UICollectionViewCompositionalLayoutConfiguration,
179        ) -> Retained<Self>;
180
181        #[unsafe(method(init))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
184
185        #[unsafe(method(new))]
186        #[unsafe(method_family = new)]
187        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
188
189        #[unsafe(method(configuration))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn configuration(
192            &self,
193        ) -> Retained<UICollectionViewCompositionalLayoutConfiguration>;
194
195        /// Setter for [`configuration`][Self::configuration].
196        #[unsafe(method(setConfiguration:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setConfiguration(
199            &self,
200            configuration: &UICollectionViewCompositionalLayoutConfiguration,
201        );
202    );
203}
204
205/// Methods declared on superclass `UICollectionViewLayout`.
206#[cfg(feature = "UICollectionViewLayout")]
207impl UICollectionViewCompositionalLayout {
208    extern_methods!(
209        #[unsafe(method(initWithCoder:))]
210        #[unsafe(method_family = init)]
211        pub unsafe fn initWithCoder(
212            this: Allocated<Self>,
213            coder: &NSCoder,
214        ) -> Option<Retained<Self>>;
215    );
216}
217
218/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionlayoutsectionorthogonalscrollingbehavior?language=objc)
219// NS_ENUM
220#[repr(transparent)]
221#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
222pub struct UICollectionLayoutSectionOrthogonalScrollingBehavior(pub NSInteger);
223impl UICollectionLayoutSectionOrthogonalScrollingBehavior {
224    #[doc(alias = "UICollectionLayoutSectionOrthogonalScrollingBehaviorNone")]
225    pub const None: Self = Self(0);
226    #[doc(alias = "UICollectionLayoutSectionOrthogonalScrollingBehaviorContinuous")]
227    pub const Continuous: Self = Self(1);
228    #[doc(
229        alias = "UICollectionLayoutSectionOrthogonalScrollingBehaviorContinuousGroupLeadingBoundary"
230    )]
231    pub const ContinuousGroupLeadingBoundary: Self = Self(2);
232    #[doc(alias = "UICollectionLayoutSectionOrthogonalScrollingBehaviorPaging")]
233    pub const Paging: Self = Self(3);
234    #[doc(alias = "UICollectionLayoutSectionOrthogonalScrollingBehaviorGroupPaging")]
235    pub const GroupPaging: Self = Self(4);
236    #[doc(alias = "UICollectionLayoutSectionOrthogonalScrollingBehaviorGroupPagingCentered")]
237    pub const GroupPagingCentered: Self = Self(5);
238}
239
240unsafe impl Encode for UICollectionLayoutSectionOrthogonalScrollingBehavior {
241    const ENCODING: Encoding = NSInteger::ENCODING;
242}
243
244unsafe impl RefEncode for UICollectionLayoutSectionOrthogonalScrollingBehavior {
245    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
246}
247
248/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutsectionvisibleitemsinvalidationhandler?language=objc)
249#[cfg(all(
250    feature = "UIDynamicBehavior",
251    feature = "block2",
252    feature = "objc2-core-foundation"
253))]
254pub type NSCollectionLayoutSectionVisibleItemsInvalidationHandler = *mut block2::Block<
255    dyn Fn(
256        NonNull<NSArray<ProtocolObject<dyn NSCollectionLayoutVisibleItem>>>,
257        CGPoint,
258        NonNull<ProtocolObject<dyn NSCollectionLayoutEnvironment>>,
259    ),
260>;
261
262/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionlayoutsectionorthogonalscrollingdecelerationrate?language=objc)
263// NS_TYPED_ENUM
264#[cfg(feature = "objc2-core-foundation")]
265pub type UICollectionLayoutSectionOrthogonalScrollingDecelerationRate = CGFloat;
266
267extern "C" {
268    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionlayoutsectionorthogonalscrollingdecelerationrateautomatic?language=objc)
269    #[cfg(feature = "objc2-core-foundation")]
270    pub static UICollectionLayoutSectionOrthogonalScrollingDecelerationRateAutomatic:
271        UICollectionLayoutSectionOrthogonalScrollingDecelerationRate;
272}
273
274extern "C" {
275    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionlayoutsectionorthogonalscrollingdecelerationratenormal?language=objc)
276    #[cfg(feature = "objc2-core-foundation")]
277    pub static UICollectionLayoutSectionOrthogonalScrollingDecelerationRateNormal:
278        UICollectionLayoutSectionOrthogonalScrollingDecelerationRate;
279}
280
281extern "C" {
282    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionlayoutsectionorthogonalscrollingdecelerationratefast?language=objc)
283    #[cfg(feature = "objc2-core-foundation")]
284    pub static UICollectionLayoutSectionOrthogonalScrollingDecelerationRateFast:
285        UICollectionLayoutSectionOrthogonalScrollingDecelerationRate;
286}
287
288/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionlayoutsectionorthogonalscrollingbounce?language=objc)
289// NS_ENUM
290#[repr(transparent)]
291#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
292pub struct UICollectionLayoutSectionOrthogonalScrollingBounce(pub NSInteger);
293impl UICollectionLayoutSectionOrthogonalScrollingBounce {
294    #[doc(alias = "UICollectionLayoutSectionOrthogonalScrollingBounceAutomatic")]
295    pub const Automatic: Self = Self(0);
296    #[doc(alias = "UICollectionLayoutSectionOrthogonalScrollingBounceAlways")]
297    pub const Always: Self = Self(1);
298    #[doc(alias = "UICollectionLayoutSectionOrthogonalScrollingBounceNever")]
299    pub const Never: Self = Self(2);
300}
301
302unsafe impl Encode for UICollectionLayoutSectionOrthogonalScrollingBounce {
303    const ENCODING: Encoding = NSInteger::ENCODING;
304}
305
306unsafe impl RefEncode for UICollectionLayoutSectionOrthogonalScrollingBounce {
307    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
308}
309
310extern_class!(
311    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionlayoutsectionorthogonalscrollingproperties?language=objc)
312    #[unsafe(super(NSObject))]
313    #[thread_kind = MainThreadOnly]
314    #[derive(Debug, PartialEq, Eq, Hash)]
315    pub struct UICollectionLayoutSectionOrthogonalScrollingProperties;
316);
317
318unsafe impl NSCopying for UICollectionLayoutSectionOrthogonalScrollingProperties {}
319
320unsafe impl CopyingHelper for UICollectionLayoutSectionOrthogonalScrollingProperties {
321    type Result = Self;
322}
323
324unsafe impl NSObjectProtocol for UICollectionLayoutSectionOrthogonalScrollingProperties {}
325
326impl UICollectionLayoutSectionOrthogonalScrollingProperties {
327    extern_methods!(
328        #[cfg(feature = "objc2-core-foundation")]
329        /// The orthogonal scroll view's rate of deceleration after the user lifts their finger.
330        #[unsafe(method(decelerationRate))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn decelerationRate(
333            &self,
334        ) -> UICollectionLayoutSectionOrthogonalScrollingDecelerationRate;
335
336        #[cfg(feature = "objc2-core-foundation")]
337        /// Setter for [`decelerationRate`][Self::decelerationRate].
338        #[unsafe(method(setDecelerationRate:))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn setDecelerationRate(
341            &self,
342            deceleration_rate: UICollectionLayoutSectionOrthogonalScrollingDecelerationRate,
343        );
344
345        /// The orthogonal scroll view's bounce behavior.
346        #[unsafe(method(bounce))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn bounce(&self) -> UICollectionLayoutSectionOrthogonalScrollingBounce;
349
350        /// Setter for [`bounce`][Self::bounce].
351        #[unsafe(method(setBounce:))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn setBounce(&self, bounce: UICollectionLayoutSectionOrthogonalScrollingBounce);
354    );
355}
356
357/// Methods declared on superclass `NSObject`.
358impl UICollectionLayoutSectionOrthogonalScrollingProperties {
359    extern_methods!(
360        #[unsafe(method(init))]
361        #[unsafe(method_family = init)]
362        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
363
364        #[unsafe(method(new))]
365        #[unsafe(method_family = new)]
366        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
367    );
368}
369
370extern_class!(
371    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutsection?language=objc)
372    #[unsafe(super(NSObject))]
373    #[thread_kind = MainThreadOnly]
374    #[derive(Debug, PartialEq, Eq, Hash)]
375    pub struct NSCollectionLayoutSection;
376);
377
378unsafe impl NSCopying for NSCollectionLayoutSection {}
379
380unsafe impl CopyingHelper for NSCollectionLayoutSection {
381    type Result = Self;
382}
383
384unsafe impl NSObjectProtocol for NSCollectionLayoutSection {}
385
386impl NSCollectionLayoutSection {
387    extern_methods!(
388        #[unsafe(method(sectionWithGroup:))]
389        #[unsafe(method_family = none)]
390        pub unsafe fn sectionWithGroup(group: &NSCollectionLayoutGroup) -> Retained<Self>;
391
392        #[unsafe(method(init))]
393        #[unsafe(method_family = init)]
394        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
395
396        #[unsafe(method(new))]
397        #[unsafe(method_family = new)]
398        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
399
400        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
401        #[unsafe(method(contentInsets))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn contentInsets(&self) -> NSDirectionalEdgeInsets;
404
405        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
406        /// Setter for [`contentInsets`][Self::contentInsets].
407        #[unsafe(method(setContentInsets:))]
408        #[unsafe(method_family = none)]
409        pub unsafe fn setContentInsets(&self, content_insets: NSDirectionalEdgeInsets);
410
411        #[cfg(feature = "objc2-core-foundation")]
412        #[unsafe(method(interGroupSpacing))]
413        #[unsafe(method_family = none)]
414        pub unsafe fn interGroupSpacing(&self) -> CGFloat;
415
416        #[cfg(feature = "objc2-core-foundation")]
417        /// Setter for [`interGroupSpacing`][Self::interGroupSpacing].
418        #[unsafe(method(setInterGroupSpacing:))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn setInterGroupSpacing(&self, inter_group_spacing: CGFloat);
421
422        #[unsafe(method(contentInsetsReference))]
423        #[unsafe(method_family = none)]
424        pub unsafe fn contentInsetsReference(&self) -> UIContentInsetsReference;
425
426        /// Setter for [`contentInsetsReference`][Self::contentInsetsReference].
427        #[unsafe(method(setContentInsetsReference:))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn setContentInsetsReference(
430            &self,
431            content_insets_reference: UIContentInsetsReference,
432        );
433
434        /// Specifies the content insets reference for boundary supplementaries in this section.
435        /// The default value of this property is UIContentInsetsReference.automatic, which means that any insets specified on a
436        /// `NSCollectionLayoutBoundarySupplementaryItem`will follow the layout configuration's
437        /// `contentInsetsReference.`
438        #[unsafe(method(supplementaryContentInsetsReference))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn supplementaryContentInsetsReference(&self) -> UIContentInsetsReference;
441
442        /// Setter for [`supplementaryContentInsetsReference`][Self::supplementaryContentInsetsReference].
443        #[unsafe(method(setSupplementaryContentInsetsReference:))]
444        #[unsafe(method_family = none)]
445        pub unsafe fn setSupplementaryContentInsetsReference(
446            &self,
447            supplementary_content_insets_reference: UIContentInsetsReference,
448        );
449
450        #[unsafe(method(orthogonalScrollingBehavior))]
451        #[unsafe(method_family = none)]
452        pub unsafe fn orthogonalScrollingBehavior(
453            &self,
454        ) -> UICollectionLayoutSectionOrthogonalScrollingBehavior;
455
456        /// Setter for [`orthogonalScrollingBehavior`][Self::orthogonalScrollingBehavior].
457        #[unsafe(method(setOrthogonalScrollingBehavior:))]
458        #[unsafe(method_family = none)]
459        pub unsafe fn setOrthogonalScrollingBehavior(
460            &self,
461            orthogonal_scrolling_behavior: UICollectionLayoutSectionOrthogonalScrollingBehavior,
462        );
463
464        #[unsafe(method(orthogonalScrollingProperties))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn orthogonalScrollingProperties(
467            &self,
468        ) -> Retained<UICollectionLayoutSectionOrthogonalScrollingProperties>;
469
470        #[unsafe(method(boundarySupplementaryItems))]
471        #[unsafe(method_family = none)]
472        pub unsafe fn boundarySupplementaryItems(
473            &self,
474        ) -> Retained<NSArray<NSCollectionLayoutBoundarySupplementaryItem>>;
475
476        /// Setter for [`boundarySupplementaryItems`][Self::boundarySupplementaryItems].
477        #[unsafe(method(setBoundarySupplementaryItems:))]
478        #[unsafe(method_family = none)]
479        pub unsafe fn setBoundarySupplementaryItems(
480            &self,
481            boundary_supplementary_items: &NSArray<NSCollectionLayoutBoundarySupplementaryItem>,
482        );
483
484        #[cfg(all(
485            feature = "UIDynamicBehavior",
486            feature = "block2",
487            feature = "objc2-core-foundation"
488        ))]
489        #[unsafe(method(visibleItemsInvalidationHandler))]
490        #[unsafe(method_family = none)]
491        pub unsafe fn visibleItemsInvalidationHandler(
492            &self,
493        ) -> NSCollectionLayoutSectionVisibleItemsInvalidationHandler;
494
495        #[cfg(all(
496            feature = "UIDynamicBehavior",
497            feature = "block2",
498            feature = "objc2-core-foundation"
499        ))]
500        /// Setter for [`visibleItemsInvalidationHandler`][Self::visibleItemsInvalidationHandler].
501        #[unsafe(method(setVisibleItemsInvalidationHandler:))]
502        #[unsafe(method_family = none)]
503        pub unsafe fn setVisibleItemsInvalidationHandler(
504            &self,
505            visible_items_invalidation_handler: NSCollectionLayoutSectionVisibleItemsInvalidationHandler,
506        );
507
508        #[unsafe(method(decorationItems))]
509        #[unsafe(method_family = none)]
510        pub unsafe fn decorationItems(&self)
511            -> Retained<NSArray<NSCollectionLayoutDecorationItem>>;
512
513        /// Setter for [`decorationItems`][Self::decorationItems].
514        #[unsafe(method(setDecorationItems:))]
515        #[unsafe(method_family = none)]
516        pub unsafe fn setDecorationItems(
517            &self,
518            decoration_items: &NSArray<NSCollectionLayoutDecorationItem>,
519        );
520    );
521}
522
523extern_class!(
524    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutitem?language=objc)
525    #[unsafe(super(NSObject))]
526    #[thread_kind = MainThreadOnly]
527    #[derive(Debug, PartialEq, Eq, Hash)]
528    pub struct NSCollectionLayoutItem;
529);
530
531unsafe impl NSCopying for NSCollectionLayoutItem {}
532
533unsafe impl CopyingHelper for NSCollectionLayoutItem {
534    type Result = Self;
535}
536
537unsafe impl NSObjectProtocol for NSCollectionLayoutItem {}
538
539impl NSCollectionLayoutItem {
540    extern_methods!(
541        #[unsafe(method(itemWithLayoutSize:))]
542        #[unsafe(method_family = none)]
543        pub unsafe fn itemWithLayoutSize(layout_size: &NSCollectionLayoutSize) -> Retained<Self>;
544
545        #[unsafe(method(itemWithLayoutSize:supplementaryItems:))]
546        #[unsafe(method_family = none)]
547        pub unsafe fn itemWithLayoutSize_supplementaryItems(
548            layout_size: &NSCollectionLayoutSize,
549            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
550        ) -> Retained<Self>;
551
552        #[unsafe(method(init))]
553        #[unsafe(method_family = init)]
554        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
555
556        #[unsafe(method(new))]
557        #[unsafe(method_family = new)]
558        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
559
560        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
561        #[unsafe(method(contentInsets))]
562        #[unsafe(method_family = none)]
563        pub unsafe fn contentInsets(&self) -> NSDirectionalEdgeInsets;
564
565        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
566        /// Setter for [`contentInsets`][Self::contentInsets].
567        #[unsafe(method(setContentInsets:))]
568        #[unsafe(method_family = none)]
569        pub unsafe fn setContentInsets(&self, content_insets: NSDirectionalEdgeInsets);
570
571        #[unsafe(method(edgeSpacing))]
572        #[unsafe(method_family = none)]
573        pub unsafe fn edgeSpacing(&self) -> Option<Retained<NSCollectionLayoutEdgeSpacing>>;
574
575        /// Setter for [`edgeSpacing`][Self::edgeSpacing].
576        #[unsafe(method(setEdgeSpacing:))]
577        #[unsafe(method_family = none)]
578        pub unsafe fn setEdgeSpacing(&self, edge_spacing: Option<&NSCollectionLayoutEdgeSpacing>);
579
580        #[unsafe(method(layoutSize))]
581        #[unsafe(method_family = none)]
582        pub unsafe fn layoutSize(&self) -> Retained<NSCollectionLayoutSize>;
583
584        #[unsafe(method(supplementaryItems))]
585        #[unsafe(method_family = none)]
586        pub unsafe fn supplementaryItems(
587            &self,
588        ) -> Retained<NSArray<NSCollectionLayoutSupplementaryItem>>;
589    );
590}
591
592extern_class!(
593    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutgroupcustomitem?language=objc)
594    #[unsafe(super(NSObject))]
595    #[thread_kind = MainThreadOnly]
596    #[derive(Debug, PartialEq, Eq, Hash)]
597    pub struct NSCollectionLayoutGroupCustomItem;
598);
599
600unsafe impl NSCopying for NSCollectionLayoutGroupCustomItem {}
601
602unsafe impl CopyingHelper for NSCollectionLayoutGroupCustomItem {
603    type Result = Self;
604}
605
606unsafe impl NSObjectProtocol for NSCollectionLayoutGroupCustomItem {}
607
608impl NSCollectionLayoutGroupCustomItem {
609    extern_methods!(
610        #[cfg(feature = "objc2-core-foundation")]
611        #[unsafe(method(customItemWithFrame:))]
612        #[unsafe(method_family = none)]
613        pub unsafe fn customItemWithFrame(frame: CGRect, mtm: MainThreadMarker) -> Retained<Self>;
614
615        #[cfg(feature = "objc2-core-foundation")]
616        #[unsafe(method(customItemWithFrame:zIndex:))]
617        #[unsafe(method_family = none)]
618        pub unsafe fn customItemWithFrame_zIndex(
619            frame: CGRect,
620            z_index: NSInteger,
621            mtm: MainThreadMarker,
622        ) -> Retained<Self>;
623
624        #[unsafe(method(init))]
625        #[unsafe(method_family = init)]
626        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
627
628        #[unsafe(method(new))]
629        #[unsafe(method_family = new)]
630        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
631
632        #[cfg(feature = "objc2-core-foundation")]
633        #[unsafe(method(frame))]
634        #[unsafe(method_family = none)]
635        pub unsafe fn frame(&self) -> CGRect;
636
637        #[unsafe(method(zIndex))]
638        #[unsafe(method_family = none)]
639        pub unsafe fn zIndex(&self) -> NSInteger;
640    );
641}
642
643/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutgroupcustomitemprovider?language=objc)
644#[cfg(feature = "block2")]
645pub type NSCollectionLayoutGroupCustomItemProvider = *mut block2::Block<
646    dyn Fn(
647        NonNull<ProtocolObject<dyn NSCollectionLayoutEnvironment>>,
648    ) -> NonNull<NSArray<NSCollectionLayoutGroupCustomItem>>,
649>;
650
651extern_class!(
652    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutgroup?language=objc)
653    #[unsafe(super(NSCollectionLayoutItem, NSObject))]
654    #[thread_kind = MainThreadOnly]
655    #[derive(Debug, PartialEq, Eq, Hash)]
656    pub struct NSCollectionLayoutGroup;
657);
658
659unsafe impl NSCopying for NSCollectionLayoutGroup {}
660
661unsafe impl CopyingHelper for NSCollectionLayoutGroup {
662    type Result = Self;
663}
664
665unsafe impl NSObjectProtocol for NSCollectionLayoutGroup {}
666
667impl NSCollectionLayoutGroup {
668    extern_methods!(
669        /// Specifies a group that will horizontally repeat its subitem a fixed number of times.
670        ///
671        /// Parameter `layoutSize`: The group's size.
672        ///
673        /// Parameter `subitem`: The subitem to repeat. It is the caller's responsibility to ensure that the group's
674        /// `layoutSize`can fit
675        /// `count`repetitions of this item.
676        ///
677        /// Parameter `count`: The number of times to repeat the passed in subitem.
678        #[unsafe(method(horizontalGroupWithLayoutSize:repeatingSubitem:count:))]
679        #[unsafe(method_family = none)]
680        pub unsafe fn horizontalGroupWithLayoutSize_repeatingSubitem_count(
681            layout_size: &NSCollectionLayoutSize,
682            subitem: &NSCollectionLayoutItem,
683            count: NSInteger,
684        ) -> Retained<Self>;
685
686        #[unsafe(method(horizontalGroupWithLayoutSize:subitems:))]
687        #[unsafe(method_family = none)]
688        pub unsafe fn horizontalGroupWithLayoutSize_subitems(
689            layout_size: &NSCollectionLayoutSize,
690            subitems: &NSArray<NSCollectionLayoutItem>,
691        ) -> Retained<Self>;
692
693        /// Specifies a group that will vertically repeat its subitem a fixed number of times.
694        ///
695        /// Parameter `layoutSize`: The group's size.
696        ///
697        /// Parameter `subitem`: The subitem to repeat. It is the caller's responsibility to ensure that the group's
698        /// `layoutSize`can fit
699        /// `count`repetitions of this item.
700        ///
701        /// Parameter `count`: The number of times to repeat the passed in subitem.
702        #[unsafe(method(verticalGroupWithLayoutSize:repeatingSubitem:count:))]
703        #[unsafe(method_family = none)]
704        pub unsafe fn verticalGroupWithLayoutSize_repeatingSubitem_count(
705            layout_size: &NSCollectionLayoutSize,
706            subitem: &NSCollectionLayoutItem,
707            count: NSInteger,
708        ) -> Retained<Self>;
709
710        #[unsafe(method(verticalGroupWithLayoutSize:subitems:))]
711        #[unsafe(method_family = none)]
712        pub unsafe fn verticalGroupWithLayoutSize_subitems(
713            layout_size: &NSCollectionLayoutSize,
714            subitems: &NSArray<NSCollectionLayoutItem>,
715        ) -> Retained<Self>;
716
717        #[cfg(feature = "block2")]
718        #[unsafe(method(customGroupWithLayoutSize:itemProvider:))]
719        #[unsafe(method_family = none)]
720        pub unsafe fn customGroupWithLayoutSize_itemProvider(
721            layout_size: &NSCollectionLayoutSize,
722            item_provider: NSCollectionLayoutGroupCustomItemProvider,
723        ) -> Retained<Self>;
724
725        #[unsafe(method(init))]
726        #[unsafe(method_family = init)]
727        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
728
729        #[unsafe(method(new))]
730        #[unsafe(method_family = new)]
731        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
732
733        #[unsafe(method(supplementaryItems))]
734        #[unsafe(method_family = none)]
735        pub unsafe fn supplementaryItems(
736            &self,
737        ) -> Retained<NSArray<NSCollectionLayoutSupplementaryItem>>;
738
739        /// Setter for [`supplementaryItems`][Self::supplementaryItems].
740        #[unsafe(method(setSupplementaryItems:))]
741        #[unsafe(method_family = none)]
742        pub unsafe fn setSupplementaryItems(
743            &self,
744            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
745        );
746
747        #[unsafe(method(interItemSpacing))]
748        #[unsafe(method_family = none)]
749        pub unsafe fn interItemSpacing(&self) -> Option<Retained<NSCollectionLayoutSpacing>>;
750
751        /// Setter for [`interItemSpacing`][Self::interItemSpacing].
752        #[unsafe(method(setInterItemSpacing:))]
753        #[unsafe(method_family = none)]
754        pub unsafe fn setInterItemSpacing(
755            &self,
756            inter_item_spacing: Option<&NSCollectionLayoutSpacing>,
757        );
758
759        #[unsafe(method(subitems))]
760        #[unsafe(method_family = none)]
761        pub unsafe fn subitems(&self) -> Retained<NSArray<NSCollectionLayoutItem>>;
762
763        #[unsafe(method(visualDescription))]
764        #[unsafe(method_family = none)]
765        pub unsafe fn visualDescription(&self) -> Retained<NSString>;
766    );
767}
768
769/// Methods declared on superclass `NSCollectionLayoutItem`.
770impl NSCollectionLayoutGroup {
771    extern_methods!(
772        #[unsafe(method(itemWithLayoutSize:))]
773        #[unsafe(method_family = none)]
774        pub unsafe fn itemWithLayoutSize(layout_size: &NSCollectionLayoutSize) -> Retained<Self>;
775
776        #[unsafe(method(itemWithLayoutSize:supplementaryItems:))]
777        #[unsafe(method_family = none)]
778        pub unsafe fn itemWithLayoutSize_supplementaryItems(
779            layout_size: &NSCollectionLayoutSize,
780            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
781        ) -> Retained<Self>;
782    );
783}
784
785extern_class!(
786    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutdimension?language=objc)
787    #[unsafe(super(NSObject))]
788    #[thread_kind = MainThreadOnly]
789    #[derive(Debug, PartialEq, Eq, Hash)]
790    pub struct NSCollectionLayoutDimension;
791);
792
793unsafe impl NSCopying for NSCollectionLayoutDimension {}
794
795unsafe impl CopyingHelper for NSCollectionLayoutDimension {
796    type Result = Self;
797}
798
799unsafe impl NSObjectProtocol for NSCollectionLayoutDimension {}
800
801impl NSCollectionLayoutDimension {
802    extern_methods!(
803        #[cfg(feature = "objc2-core-foundation")]
804        #[unsafe(method(fractionalWidthDimension:))]
805        #[unsafe(method_family = none)]
806        pub unsafe fn fractionalWidthDimension(
807            fractional_width: CGFloat,
808            mtm: MainThreadMarker,
809        ) -> Retained<Self>;
810
811        #[cfg(feature = "objc2-core-foundation")]
812        #[unsafe(method(fractionalHeightDimension:))]
813        #[unsafe(method_family = none)]
814        pub unsafe fn fractionalHeightDimension(
815            fractional_height: CGFloat,
816            mtm: MainThreadMarker,
817        ) -> Retained<Self>;
818
819        #[cfg(feature = "objc2-core-foundation")]
820        #[unsafe(method(absoluteDimension:))]
821        #[unsafe(method_family = none)]
822        pub unsafe fn absoluteDimension(
823            absolute_dimension: CGFloat,
824            mtm: MainThreadMarker,
825        ) -> Retained<Self>;
826
827        #[cfg(feature = "objc2-core-foundation")]
828        #[unsafe(method(estimatedDimension:))]
829        #[unsafe(method_family = none)]
830        pub unsafe fn estimatedDimension(
831            estimated_dimension: CGFloat,
832            mtm: MainThreadMarker,
833        ) -> Retained<Self>;
834
835        #[cfg(feature = "objc2-core-foundation")]
836        /// Items with this dimension type will receive at least as much room as the view requires, and will
837        /// grow to match the dimension of the largest estimated sibling in their parent.
838        /// When specified on the outermost group for a section, the largest size will be shared across the entire section.
839        ///
840        /// Eg: All `NSCollectionLayoutItem`s specified with a `uniformAcrossSiblingsWithEstimate:` `heightDimension` in a horizontal `NSCollectionLayoutGroup`
841        /// will have a height equal to the height of the tallest item in that group.
842        ///
843        /// When computing the size for a dimension of this type, the layout will need to retrieve preferred attributes for all siblings
844        /// in its parent, which in `UICollectionView` means creating views for all dependent items. This can be very expensive, so `uniformAcrossSiblingsWithEstimate` should
845        /// only be used in layouts where the number of dependent items is known to be relatively small.
846        #[unsafe(method(uniformAcrossSiblingsWithEstimate:))]
847        #[unsafe(method_family = none)]
848        pub unsafe fn uniformAcrossSiblingsWithEstimate(
849            estimated_dimension: CGFloat,
850            mtm: MainThreadMarker,
851        ) -> Retained<Self>;
852
853        #[unsafe(method(init))]
854        #[unsafe(method_family = init)]
855        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
856
857        #[unsafe(method(new))]
858        #[unsafe(method_family = new)]
859        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
860
861        #[unsafe(method(isFractionalWidth))]
862        #[unsafe(method_family = none)]
863        pub unsafe fn isFractionalWidth(&self) -> bool;
864
865        #[unsafe(method(isFractionalHeight))]
866        #[unsafe(method_family = none)]
867        pub unsafe fn isFractionalHeight(&self) -> bool;
868
869        #[unsafe(method(isAbsolute))]
870        #[unsafe(method_family = none)]
871        pub unsafe fn isAbsolute(&self) -> bool;
872
873        /// Returns `YES` if the receiver is `estimated` OR `uniformAcrossSiblings`.
874        #[unsafe(method(isEstimated))]
875        #[unsafe(method_family = none)]
876        pub unsafe fn isEstimated(&self) -> bool;
877
878        #[unsafe(method(isUniformAcrossSiblings))]
879        #[unsafe(method_family = none)]
880        pub unsafe fn isUniformAcrossSiblings(&self) -> bool;
881
882        #[cfg(feature = "objc2-core-foundation")]
883        #[unsafe(method(dimension))]
884        #[unsafe(method_family = none)]
885        pub unsafe fn dimension(&self) -> CGFloat;
886    );
887}
888
889extern_class!(
890    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutsize?language=objc)
891    #[unsafe(super(NSObject))]
892    #[thread_kind = MainThreadOnly]
893    #[derive(Debug, PartialEq, Eq, Hash)]
894    pub struct NSCollectionLayoutSize;
895);
896
897unsafe impl NSCopying for NSCollectionLayoutSize {}
898
899unsafe impl CopyingHelper for NSCollectionLayoutSize {
900    type Result = Self;
901}
902
903unsafe impl NSObjectProtocol for NSCollectionLayoutSize {}
904
905impl NSCollectionLayoutSize {
906    extern_methods!(
907        #[unsafe(method(sizeWithWidthDimension:heightDimension:))]
908        #[unsafe(method_family = none)]
909        pub unsafe fn sizeWithWidthDimension_heightDimension(
910            width: &NSCollectionLayoutDimension,
911            height: &NSCollectionLayoutDimension,
912        ) -> Retained<Self>;
913
914        #[unsafe(method(init))]
915        #[unsafe(method_family = init)]
916        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
917
918        #[unsafe(method(new))]
919        #[unsafe(method_family = new)]
920        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
921
922        #[unsafe(method(widthDimension))]
923        #[unsafe(method_family = none)]
924        pub unsafe fn widthDimension(&self) -> Retained<NSCollectionLayoutDimension>;
925
926        #[unsafe(method(heightDimension))]
927        #[unsafe(method_family = none)]
928        pub unsafe fn heightDimension(&self) -> Retained<NSCollectionLayoutDimension>;
929    );
930}
931
932extern_class!(
933    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutspacing?language=objc)
934    #[unsafe(super(NSObject))]
935    #[thread_kind = MainThreadOnly]
936    #[derive(Debug, PartialEq, Eq, Hash)]
937    pub struct NSCollectionLayoutSpacing;
938);
939
940unsafe impl NSCopying for NSCollectionLayoutSpacing {}
941
942unsafe impl CopyingHelper for NSCollectionLayoutSpacing {
943    type Result = Self;
944}
945
946unsafe impl NSObjectProtocol for NSCollectionLayoutSpacing {}
947
948impl NSCollectionLayoutSpacing {
949    extern_methods!(
950        #[cfg(feature = "objc2-core-foundation")]
951        #[unsafe(method(flexibleSpacing:))]
952        #[unsafe(method_family = none)]
953        pub unsafe fn flexibleSpacing(
954            flexible_spacing: CGFloat,
955            mtm: MainThreadMarker,
956        ) -> Retained<Self>;
957
958        #[cfg(feature = "objc2-core-foundation")]
959        #[unsafe(method(fixedSpacing:))]
960        #[unsafe(method_family = none)]
961        pub unsafe fn fixedSpacing(fixed_spacing: CGFloat, mtm: MainThreadMarker)
962            -> Retained<Self>;
963
964        #[unsafe(method(init))]
965        #[unsafe(method_family = init)]
966        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
967
968        #[unsafe(method(new))]
969        #[unsafe(method_family = new)]
970        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
971
972        #[cfg(feature = "objc2-core-foundation")]
973        #[unsafe(method(spacing))]
974        #[unsafe(method_family = none)]
975        pub unsafe fn spacing(&self) -> CGFloat;
976
977        #[unsafe(method(isFlexibleSpacing))]
978        #[unsafe(method_family = none)]
979        pub unsafe fn isFlexibleSpacing(&self) -> bool;
980
981        #[unsafe(method(isFixedSpacing))]
982        #[unsafe(method_family = none)]
983        pub unsafe fn isFixedSpacing(&self) -> bool;
984    );
985}
986
987extern_class!(
988    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutedgespacing?language=objc)
989    #[unsafe(super(NSObject))]
990    #[thread_kind = MainThreadOnly]
991    #[derive(Debug, PartialEq, Eq, Hash)]
992    pub struct NSCollectionLayoutEdgeSpacing;
993);
994
995unsafe impl NSCopying for NSCollectionLayoutEdgeSpacing {}
996
997unsafe impl CopyingHelper for NSCollectionLayoutEdgeSpacing {
998    type Result = Self;
999}
1000
1001unsafe impl NSObjectProtocol for NSCollectionLayoutEdgeSpacing {}
1002
1003impl NSCollectionLayoutEdgeSpacing {
1004    extern_methods!(
1005        #[unsafe(method(spacingForLeading:top:trailing:bottom:))]
1006        #[unsafe(method_family = none)]
1007        pub unsafe fn spacingForLeading_top_trailing_bottom(
1008            leading: Option<&NSCollectionLayoutSpacing>,
1009            top: Option<&NSCollectionLayoutSpacing>,
1010            trailing: Option<&NSCollectionLayoutSpacing>,
1011            bottom: Option<&NSCollectionLayoutSpacing>,
1012            mtm: MainThreadMarker,
1013        ) -> Retained<Self>;
1014
1015        #[unsafe(method(init))]
1016        #[unsafe(method_family = init)]
1017        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1018
1019        #[unsafe(method(new))]
1020        #[unsafe(method_family = new)]
1021        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1022
1023        #[unsafe(method(leading))]
1024        #[unsafe(method_family = none)]
1025        pub unsafe fn leading(&self) -> Option<Retained<NSCollectionLayoutSpacing>>;
1026
1027        #[unsafe(method(top))]
1028        #[unsafe(method_family = none)]
1029        pub unsafe fn top(&self) -> Option<Retained<NSCollectionLayoutSpacing>>;
1030
1031        #[unsafe(method(trailing))]
1032        #[unsafe(method_family = none)]
1033        pub unsafe fn trailing(&self) -> Option<Retained<NSCollectionLayoutSpacing>>;
1034
1035        #[unsafe(method(bottom))]
1036        #[unsafe(method_family = none)]
1037        pub unsafe fn bottom(&self) -> Option<Retained<NSCollectionLayoutSpacing>>;
1038    );
1039}
1040
1041extern_class!(
1042    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutsupplementaryitem?language=objc)
1043    #[unsafe(super(NSCollectionLayoutItem, NSObject))]
1044    #[thread_kind = MainThreadOnly]
1045    #[derive(Debug, PartialEq, Eq, Hash)]
1046    pub struct NSCollectionLayoutSupplementaryItem;
1047);
1048
1049unsafe impl NSCopying for NSCollectionLayoutSupplementaryItem {}
1050
1051unsafe impl CopyingHelper for NSCollectionLayoutSupplementaryItem {
1052    type Result = Self;
1053}
1054
1055unsafe impl NSObjectProtocol for NSCollectionLayoutSupplementaryItem {}
1056
1057impl NSCollectionLayoutSupplementaryItem {
1058    extern_methods!(
1059        #[unsafe(method(supplementaryItemWithLayoutSize:elementKind:containerAnchor:))]
1060        #[unsafe(method_family = none)]
1061        pub unsafe fn supplementaryItemWithLayoutSize_elementKind_containerAnchor(
1062            layout_size: &NSCollectionLayoutSize,
1063            element_kind: &NSString,
1064            container_anchor: &NSCollectionLayoutAnchor,
1065        ) -> Retained<Self>;
1066
1067        #[unsafe(method(supplementaryItemWithLayoutSize:elementKind:containerAnchor:itemAnchor:))]
1068        #[unsafe(method_family = none)]
1069        pub unsafe fn supplementaryItemWithLayoutSize_elementKind_containerAnchor_itemAnchor(
1070            layout_size: &NSCollectionLayoutSize,
1071            element_kind: &NSString,
1072            container_anchor: &NSCollectionLayoutAnchor,
1073            item_anchor: &NSCollectionLayoutAnchor,
1074        ) -> Retained<Self>;
1075
1076        #[unsafe(method(init))]
1077        #[unsafe(method_family = init)]
1078        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1079
1080        #[unsafe(method(new))]
1081        #[unsafe(method_family = new)]
1082        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1083
1084        #[unsafe(method(zIndex))]
1085        #[unsafe(method_family = none)]
1086        pub unsafe fn zIndex(&self) -> NSInteger;
1087
1088        /// Setter for [`zIndex`][Self::zIndex].
1089        #[unsafe(method(setZIndex:))]
1090        #[unsafe(method_family = none)]
1091        pub unsafe fn setZIndex(&self, z_index: NSInteger);
1092
1093        #[unsafe(method(elementKind))]
1094        #[unsafe(method_family = none)]
1095        pub unsafe fn elementKind(&self) -> Retained<NSString>;
1096
1097        #[unsafe(method(containerAnchor))]
1098        #[unsafe(method_family = none)]
1099        pub unsafe fn containerAnchor(&self) -> Retained<NSCollectionLayoutAnchor>;
1100
1101        #[unsafe(method(itemAnchor))]
1102        #[unsafe(method_family = none)]
1103        pub unsafe fn itemAnchor(&self) -> Option<Retained<NSCollectionLayoutAnchor>>;
1104    );
1105}
1106
1107/// Methods declared on superclass `NSCollectionLayoutItem`.
1108impl NSCollectionLayoutSupplementaryItem {
1109    extern_methods!(
1110        #[unsafe(method(itemWithLayoutSize:))]
1111        #[unsafe(method_family = none)]
1112        pub unsafe fn itemWithLayoutSize(layout_size: &NSCollectionLayoutSize) -> Retained<Self>;
1113
1114        #[unsafe(method(itemWithLayoutSize:supplementaryItems:))]
1115        #[unsafe(method_family = none)]
1116        pub unsafe fn itemWithLayoutSize_supplementaryItems(
1117            layout_size: &NSCollectionLayoutSize,
1118            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
1119        ) -> Retained<Self>;
1120    );
1121}
1122
1123extern_class!(
1124    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutboundarysupplementaryitem?language=objc)
1125    #[unsafe(super(NSCollectionLayoutSupplementaryItem, NSCollectionLayoutItem, NSObject))]
1126    #[thread_kind = MainThreadOnly]
1127    #[derive(Debug, PartialEq, Eq, Hash)]
1128    pub struct NSCollectionLayoutBoundarySupplementaryItem;
1129);
1130
1131unsafe impl NSCopying for NSCollectionLayoutBoundarySupplementaryItem {}
1132
1133unsafe impl CopyingHelper for NSCollectionLayoutBoundarySupplementaryItem {
1134    type Result = Self;
1135}
1136
1137unsafe impl NSObjectProtocol for NSCollectionLayoutBoundarySupplementaryItem {}
1138
1139impl NSCollectionLayoutBoundarySupplementaryItem {
1140    extern_methods!(
1141        #[cfg(feature = "UIGeometry")]
1142        #[unsafe(method(boundarySupplementaryItemWithLayoutSize:elementKind:alignment:))]
1143        #[unsafe(method_family = none)]
1144        pub unsafe fn boundarySupplementaryItemWithLayoutSize_elementKind_alignment(
1145            layout_size: &NSCollectionLayoutSize,
1146            element_kind: &NSString,
1147            alignment: NSRectAlignment,
1148        ) -> Retained<Self>;
1149
1150        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1151        #[unsafe(method(boundarySupplementaryItemWithLayoutSize:elementKind:alignment:absoluteOffset:))]
1152        #[unsafe(method_family = none)]
1153        pub unsafe fn boundarySupplementaryItemWithLayoutSize_elementKind_alignment_absoluteOffset(
1154            layout_size: &NSCollectionLayoutSize,
1155            element_kind: &NSString,
1156            alignment: NSRectAlignment,
1157            absolute_offset: CGPoint,
1158        ) -> Retained<Self>;
1159
1160        #[unsafe(method(init))]
1161        #[unsafe(method_family = init)]
1162        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1163
1164        #[unsafe(method(new))]
1165        #[unsafe(method_family = new)]
1166        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1167
1168        #[unsafe(method(extendsBoundary))]
1169        #[unsafe(method_family = none)]
1170        pub unsafe fn extendsBoundary(&self) -> bool;
1171
1172        /// Setter for [`extendsBoundary`][Self::extendsBoundary].
1173        #[unsafe(method(setExtendsBoundary:))]
1174        #[unsafe(method_family = none)]
1175        pub unsafe fn setExtendsBoundary(&self, extends_boundary: bool);
1176
1177        #[unsafe(method(pinToVisibleBounds))]
1178        #[unsafe(method_family = none)]
1179        pub unsafe fn pinToVisibleBounds(&self) -> bool;
1180
1181        /// Setter for [`pinToVisibleBounds`][Self::pinToVisibleBounds].
1182        #[unsafe(method(setPinToVisibleBounds:))]
1183        #[unsafe(method_family = none)]
1184        pub unsafe fn setPinToVisibleBounds(&self, pin_to_visible_bounds: bool);
1185
1186        #[cfg(feature = "UIGeometry")]
1187        #[unsafe(method(alignment))]
1188        #[unsafe(method_family = none)]
1189        pub unsafe fn alignment(&self) -> NSRectAlignment;
1190
1191        #[cfg(feature = "objc2-core-foundation")]
1192        #[unsafe(method(offset))]
1193        #[unsafe(method_family = none)]
1194        pub unsafe fn offset(&self) -> CGPoint;
1195    );
1196}
1197
1198/// Methods declared on superclass `NSCollectionLayoutSupplementaryItem`.
1199impl NSCollectionLayoutBoundarySupplementaryItem {
1200    extern_methods!(
1201        #[unsafe(method(supplementaryItemWithLayoutSize:elementKind:containerAnchor:))]
1202        #[unsafe(method_family = none)]
1203        pub unsafe fn supplementaryItemWithLayoutSize_elementKind_containerAnchor(
1204            layout_size: &NSCollectionLayoutSize,
1205            element_kind: &NSString,
1206            container_anchor: &NSCollectionLayoutAnchor,
1207        ) -> Retained<Self>;
1208
1209        #[unsafe(method(supplementaryItemWithLayoutSize:elementKind:containerAnchor:itemAnchor:))]
1210        #[unsafe(method_family = none)]
1211        pub unsafe fn supplementaryItemWithLayoutSize_elementKind_containerAnchor_itemAnchor(
1212            layout_size: &NSCollectionLayoutSize,
1213            element_kind: &NSString,
1214            container_anchor: &NSCollectionLayoutAnchor,
1215            item_anchor: &NSCollectionLayoutAnchor,
1216        ) -> Retained<Self>;
1217    );
1218}
1219
1220/// Methods declared on superclass `NSCollectionLayoutItem`.
1221impl NSCollectionLayoutBoundarySupplementaryItem {
1222    extern_methods!(
1223        #[unsafe(method(itemWithLayoutSize:))]
1224        #[unsafe(method_family = none)]
1225        pub unsafe fn itemWithLayoutSize(layout_size: &NSCollectionLayoutSize) -> Retained<Self>;
1226
1227        #[unsafe(method(itemWithLayoutSize:supplementaryItems:))]
1228        #[unsafe(method_family = none)]
1229        pub unsafe fn itemWithLayoutSize_supplementaryItems(
1230            layout_size: &NSCollectionLayoutSize,
1231            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
1232        ) -> Retained<Self>;
1233    );
1234}
1235
1236extern_class!(
1237    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutdecorationitem?language=objc)
1238    #[unsafe(super(NSCollectionLayoutItem, NSObject))]
1239    #[thread_kind = MainThreadOnly]
1240    #[derive(Debug, PartialEq, Eq, Hash)]
1241    pub struct NSCollectionLayoutDecorationItem;
1242);
1243
1244unsafe impl NSCopying for NSCollectionLayoutDecorationItem {}
1245
1246unsafe impl CopyingHelper for NSCollectionLayoutDecorationItem {
1247    type Result = Self;
1248}
1249
1250unsafe impl NSObjectProtocol for NSCollectionLayoutDecorationItem {}
1251
1252impl NSCollectionLayoutDecorationItem {
1253    extern_methods!(
1254        #[unsafe(method(backgroundDecorationItemWithElementKind:))]
1255        #[unsafe(method_family = none)]
1256        pub unsafe fn backgroundDecorationItemWithElementKind(
1257            element_kind: &NSString,
1258            mtm: MainThreadMarker,
1259        ) -> Retained<Self>;
1260
1261        #[unsafe(method(init))]
1262        #[unsafe(method_family = init)]
1263        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1264
1265        #[unsafe(method(new))]
1266        #[unsafe(method_family = new)]
1267        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1268
1269        #[unsafe(method(zIndex))]
1270        #[unsafe(method_family = none)]
1271        pub unsafe fn zIndex(&self) -> NSInteger;
1272
1273        /// Setter for [`zIndex`][Self::zIndex].
1274        #[unsafe(method(setZIndex:))]
1275        #[unsafe(method_family = none)]
1276        pub unsafe fn setZIndex(&self, z_index: NSInteger);
1277
1278        #[unsafe(method(elementKind))]
1279        #[unsafe(method_family = none)]
1280        pub unsafe fn elementKind(&self) -> Retained<NSString>;
1281    );
1282}
1283
1284/// Methods declared on superclass `NSCollectionLayoutItem`.
1285impl NSCollectionLayoutDecorationItem {
1286    extern_methods!(
1287        #[unsafe(method(itemWithLayoutSize:))]
1288        #[unsafe(method_family = none)]
1289        pub unsafe fn itemWithLayoutSize(layout_size: &NSCollectionLayoutSize) -> Retained<Self>;
1290
1291        #[unsafe(method(itemWithLayoutSize:supplementaryItems:))]
1292        #[unsafe(method_family = none)]
1293        pub unsafe fn itemWithLayoutSize_supplementaryItems(
1294            layout_size: &NSCollectionLayoutSize,
1295            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
1296        ) -> Retained<Self>;
1297    );
1298}
1299
1300extern_class!(
1301    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutanchor?language=objc)
1302    #[unsafe(super(NSObject))]
1303    #[thread_kind = MainThreadOnly]
1304    #[derive(Debug, PartialEq, Eq, Hash)]
1305    pub struct NSCollectionLayoutAnchor;
1306);
1307
1308unsafe impl NSCopying for NSCollectionLayoutAnchor {}
1309
1310unsafe impl CopyingHelper for NSCollectionLayoutAnchor {
1311    type Result = Self;
1312}
1313
1314unsafe impl NSObjectProtocol for NSCollectionLayoutAnchor {}
1315
1316impl NSCollectionLayoutAnchor {
1317    extern_methods!(
1318        #[cfg(feature = "UIGeometry")]
1319        #[unsafe(method(layoutAnchorWithEdges:))]
1320        #[unsafe(method_family = none)]
1321        pub unsafe fn layoutAnchorWithEdges(
1322            edges: NSDirectionalRectEdge,
1323            mtm: MainThreadMarker,
1324        ) -> Retained<Self>;
1325
1326        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1327        #[unsafe(method(layoutAnchorWithEdges:absoluteOffset:))]
1328        #[unsafe(method_family = none)]
1329        pub unsafe fn layoutAnchorWithEdges_absoluteOffset(
1330            edges: NSDirectionalRectEdge,
1331            absolute_offset: CGPoint,
1332            mtm: MainThreadMarker,
1333        ) -> Retained<Self>;
1334
1335        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1336        #[unsafe(method(layoutAnchorWithEdges:fractionalOffset:))]
1337        #[unsafe(method_family = none)]
1338        pub unsafe fn layoutAnchorWithEdges_fractionalOffset(
1339            edges: NSDirectionalRectEdge,
1340            fractional_offset: CGPoint,
1341            mtm: MainThreadMarker,
1342        ) -> Retained<Self>;
1343
1344        #[unsafe(method(init))]
1345        #[unsafe(method_family = init)]
1346        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1347
1348        #[unsafe(method(new))]
1349        #[unsafe(method_family = new)]
1350        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1351
1352        #[cfg(feature = "UIGeometry")]
1353        #[unsafe(method(edges))]
1354        #[unsafe(method_family = none)]
1355        pub unsafe fn edges(&self) -> NSDirectionalRectEdge;
1356
1357        #[cfg(feature = "objc2-core-foundation")]
1358        #[unsafe(method(offset))]
1359        #[unsafe(method_family = none)]
1360        pub unsafe fn offset(&self) -> CGPoint;
1361
1362        #[unsafe(method(isAbsoluteOffset))]
1363        #[unsafe(method_family = none)]
1364        pub unsafe fn isAbsoluteOffset(&self) -> bool;
1365
1366        #[unsafe(method(isFractionalOffset))]
1367        #[unsafe(method_family = none)]
1368        pub unsafe fn isFractionalOffset(&self) -> bool;
1369    );
1370}
1371
1372extern_protocol!(
1373    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutcontainer?language=objc)
1374    pub unsafe trait NSCollectionLayoutContainer: NSObjectProtocol + MainThreadOnly {
1375        #[cfg(feature = "objc2-core-foundation")]
1376        #[unsafe(method(contentSize))]
1377        #[unsafe(method_family = none)]
1378        unsafe fn contentSize(&self) -> CGSize;
1379
1380        #[cfg(feature = "objc2-core-foundation")]
1381        #[unsafe(method(effectiveContentSize))]
1382        #[unsafe(method_family = none)]
1383        unsafe fn effectiveContentSize(&self) -> CGSize;
1384
1385        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1386        #[unsafe(method(contentInsets))]
1387        #[unsafe(method_family = none)]
1388        unsafe fn contentInsets(&self) -> NSDirectionalEdgeInsets;
1389
1390        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1391        #[unsafe(method(effectiveContentInsets))]
1392        #[unsafe(method_family = none)]
1393        unsafe fn effectiveContentInsets(&self) -> NSDirectionalEdgeInsets;
1394    }
1395);
1396
1397extern_protocol!(
1398    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutenvironment?language=objc)
1399    pub unsafe trait NSCollectionLayoutEnvironment:
1400        NSObjectProtocol + MainThreadOnly
1401    {
1402        #[unsafe(method(container))]
1403        #[unsafe(method_family = none)]
1404        unsafe fn container(&self) -> Retained<ProtocolObject<dyn NSCollectionLayoutContainer>>;
1405
1406        #[cfg(feature = "UITraitCollection")]
1407        #[unsafe(method(traitCollection))]
1408        #[unsafe(method_family = none)]
1409        unsafe fn traitCollection(&self) -> Retained<UITraitCollection>;
1410    }
1411);
1412
1413extern_protocol!(
1414    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nscollectionlayoutvisibleitem?language=objc)
1415    #[cfg(feature = "UIDynamicBehavior")]
1416    pub unsafe trait NSCollectionLayoutVisibleItem:
1417        NSObjectProtocol + UIDynamicItem + MainThreadOnly
1418    {
1419        #[cfg(feature = "objc2-core-foundation")]
1420        #[unsafe(method(alpha))]
1421        #[unsafe(method_family = none)]
1422        unsafe fn alpha(&self) -> CGFloat;
1423
1424        #[cfg(feature = "objc2-core-foundation")]
1425        /// Setter for [`alpha`][Self::alpha].
1426        #[unsafe(method(setAlpha:))]
1427        #[unsafe(method_family = none)]
1428        unsafe fn setAlpha(&self, alpha: CGFloat);
1429
1430        #[unsafe(method(zIndex))]
1431        #[unsafe(method_family = none)]
1432        unsafe fn zIndex(&self) -> NSInteger;
1433
1434        /// Setter for [`zIndex`][Self::zIndex].
1435        #[unsafe(method(setZIndex:))]
1436        #[unsafe(method_family = none)]
1437        unsafe fn setZIndex(&self, z_index: NSInteger);
1438
1439        #[unsafe(method(isHidden))]
1440        #[unsafe(method_family = none)]
1441        unsafe fn isHidden(&self) -> bool;
1442
1443        /// Setter for [`isHidden`][Self::isHidden].
1444        #[unsafe(method(setHidden:))]
1445        #[unsafe(method_family = none)]
1446        unsafe fn setHidden(&self, hidden: bool);
1447
1448        #[cfg(feature = "objc2-core-foundation")]
1449        #[unsafe(method(center))]
1450        #[unsafe(method_family = none)]
1451        unsafe fn center(&self) -> CGPoint;
1452
1453        #[cfg(feature = "objc2-core-foundation")]
1454        /// Setter for [`center`][Self::center].
1455        #[unsafe(method(setCenter:))]
1456        #[unsafe(method_family = none)]
1457        unsafe fn setCenter(&self, center: CGPoint);
1458
1459        #[cfg(feature = "objc2-core-foundation")]
1460        #[unsafe(method(transform))]
1461        #[unsafe(method_family = none)]
1462        unsafe fn transform(&self) -> CGAffineTransform;
1463
1464        #[cfg(feature = "objc2-core-foundation")]
1465        /// Setter for [`transform`][Self::transform].
1466        #[unsafe(method(setTransform:))]
1467        #[unsafe(method_family = none)]
1468        unsafe fn setTransform(&self, transform: CGAffineTransform);
1469
1470        #[cfg(feature = "objc2-quartz-core")]
1471        #[cfg(not(target_os = "watchos"))]
1472        #[unsafe(method(transform3D))]
1473        #[unsafe(method_family = none)]
1474        unsafe fn transform3D(&self) -> CATransform3D;
1475
1476        #[cfg(feature = "objc2-quartz-core")]
1477        #[cfg(not(target_os = "watchos"))]
1478        /// Setter for [`transform3D`][Self::transform3D].
1479        #[unsafe(method(setTransform3D:))]
1480        #[unsafe(method_family = none)]
1481        unsafe fn setTransform3D(&self, transform3_d: CATransform3D);
1482
1483        #[unsafe(method(name))]
1484        #[unsafe(method_family = none)]
1485        unsafe fn name(&self) -> Retained<NSString>;
1486
1487        #[unsafe(method(indexPath))]
1488        #[unsafe(method_family = none)]
1489        unsafe fn indexPath(&self) -> Retained<NSIndexPath>;
1490
1491        #[cfg(feature = "objc2-core-foundation")]
1492        #[unsafe(method(frame))]
1493        #[unsafe(method_family = none)]
1494        unsafe fn frame(&self) -> CGRect;
1495
1496        #[cfg(feature = "objc2-core-foundation")]
1497        #[unsafe(method(bounds))]
1498        #[unsafe(method_family = none)]
1499        unsafe fn bounds(&self) -> CGRect;
1500
1501        #[cfg(feature = "UICollectionViewLayout")]
1502        #[unsafe(method(representedElementCategory))]
1503        #[unsafe(method_family = none)]
1504        unsafe fn representedElementCategory(&self) -> UICollectionElementCategory;
1505
1506        #[unsafe(method(representedElementKind))]
1507        #[unsafe(method_family = none)]
1508        unsafe fn representedElementKind(&self) -> Option<Retained<NSString>>;
1509    }
1510);
1511
1512/// Deprecated.
1513impl NSCollectionLayoutSection {
1514    extern_methods!(
1515        #[deprecated]
1516        #[unsafe(method(supplementariesFollowContentInsets))]
1517        #[unsafe(method_family = none)]
1518        pub unsafe fn supplementariesFollowContentInsets(&self) -> bool;
1519
1520        /// Setter for [`supplementariesFollowContentInsets`][Self::supplementariesFollowContentInsets].
1521        #[deprecated]
1522        #[unsafe(method(setSupplementariesFollowContentInsets:))]
1523        #[unsafe(method_family = none)]
1524        pub unsafe fn setSupplementariesFollowContentInsets(
1525            &self,
1526            supplementaries_follow_content_insets: bool,
1527        );
1528    );
1529}
1530
1531/// Deprecated.
1532impl NSCollectionLayoutGroup {
1533    extern_methods!(
1534        #[deprecated]
1535        #[unsafe(method(horizontalGroupWithLayoutSize:subitem:count:))]
1536        #[unsafe(method_family = none)]
1537        pub unsafe fn horizontalGroupWithLayoutSize_subitem_count(
1538            layout_size: &NSCollectionLayoutSize,
1539            subitem: &NSCollectionLayoutItem,
1540            count: NSInteger,
1541        ) -> Retained<Self>;
1542
1543        #[deprecated]
1544        #[unsafe(method(verticalGroupWithLayoutSize:subitem:count:))]
1545        #[unsafe(method_family = none)]
1546        pub unsafe fn verticalGroupWithLayoutSize_subitem_count(
1547            layout_size: &NSCollectionLayoutSize,
1548            subitem: &NSCollectionLayoutItem,
1549            count: NSInteger,
1550        ) -> Retained<Self>;
1551    );
1552}