objc2_ui_kit/generated/
UIView.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/uiviewanimationcurve?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UIViewAnimationCurve(pub NSInteger);
20impl UIViewAnimationCurve {
21    #[doc(alias = "UIViewAnimationCurveEaseInOut")]
22    pub const EaseInOut: Self = Self(0);
23    #[doc(alias = "UIViewAnimationCurveEaseIn")]
24    pub const EaseIn: Self = Self(1);
25    #[doc(alias = "UIViewAnimationCurveEaseOut")]
26    pub const EaseOut: Self = Self(2);
27    #[doc(alias = "UIViewAnimationCurveLinear")]
28    pub const Linear: Self = Self(3);
29}
30
31unsafe impl Encode for UIViewAnimationCurve {
32    const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for UIViewAnimationCurve {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontentmode?language=objc)
40// NS_ENUM
41#[repr(transparent)]
42#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
43pub struct UIViewContentMode(pub NSInteger);
44impl UIViewContentMode {
45    #[doc(alias = "UIViewContentModeScaleToFill")]
46    pub const ScaleToFill: Self = Self(0);
47    #[doc(alias = "UIViewContentModeScaleAspectFit")]
48    pub const ScaleAspectFit: Self = Self(1);
49    #[doc(alias = "UIViewContentModeScaleAspectFill")]
50    pub const ScaleAspectFill: Self = Self(2);
51    #[doc(alias = "UIViewContentModeRedraw")]
52    pub const Redraw: Self = Self(3);
53    #[doc(alias = "UIViewContentModeCenter")]
54    pub const Center: Self = Self(4);
55    #[doc(alias = "UIViewContentModeTop")]
56    pub const Top: Self = Self(5);
57    #[doc(alias = "UIViewContentModeBottom")]
58    pub const Bottom: Self = Self(6);
59    #[doc(alias = "UIViewContentModeLeft")]
60    pub const Left: Self = Self(7);
61    #[doc(alias = "UIViewContentModeRight")]
62    pub const Right: Self = Self(8);
63    #[doc(alias = "UIViewContentModeTopLeft")]
64    pub const TopLeft: Self = Self(9);
65    #[doc(alias = "UIViewContentModeTopRight")]
66    pub const TopRight: Self = Self(10);
67    #[doc(alias = "UIViewContentModeBottomLeft")]
68    pub const BottomLeft: Self = Self(11);
69    #[doc(alias = "UIViewContentModeBottomRight")]
70    pub const BottomRight: Self = Self(12);
71}
72
73unsafe impl Encode for UIViewContentMode {
74    const ENCODING: Encoding = NSInteger::ENCODING;
75}
76
77unsafe impl RefEncode for UIViewContentMode {
78    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
79}
80
81/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewanimationtransition?language=objc)
82// NS_ENUM
83#[repr(transparent)]
84#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
85pub struct UIViewAnimationTransition(pub NSInteger);
86impl UIViewAnimationTransition {
87    #[doc(alias = "UIViewAnimationTransitionNone")]
88    pub const None: Self = Self(0);
89    #[doc(alias = "UIViewAnimationTransitionFlipFromLeft")]
90    pub const FlipFromLeft: Self = Self(1);
91    #[doc(alias = "UIViewAnimationTransitionFlipFromRight")]
92    pub const FlipFromRight: Self = Self(2);
93    #[doc(alias = "UIViewAnimationTransitionCurlUp")]
94    pub const CurlUp: Self = Self(3);
95    #[doc(alias = "UIViewAnimationTransitionCurlDown")]
96    pub const CurlDown: Self = Self(4);
97}
98
99unsafe impl Encode for UIViewAnimationTransition {
100    const ENCODING: Encoding = NSInteger::ENCODING;
101}
102
103unsafe impl RefEncode for UIViewAnimationTransition {
104    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
105}
106
107/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewautoresizing?language=objc)
108// NS_OPTIONS
109#[repr(transparent)]
110#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
111pub struct UIViewAutoresizing(pub NSUInteger);
112bitflags::bitflags! {
113    impl UIViewAutoresizing: NSUInteger {
114        #[doc(alias = "UIViewAutoresizingNone")]
115        const None = 0;
116        #[doc(alias = "UIViewAutoresizingFlexibleLeftMargin")]
117        const FlexibleLeftMargin = 1<<0;
118        #[doc(alias = "UIViewAutoresizingFlexibleWidth")]
119        const FlexibleWidth = 1<<1;
120        #[doc(alias = "UIViewAutoresizingFlexibleRightMargin")]
121        const FlexibleRightMargin = 1<<2;
122        #[doc(alias = "UIViewAutoresizingFlexibleTopMargin")]
123        const FlexibleTopMargin = 1<<3;
124        #[doc(alias = "UIViewAutoresizingFlexibleHeight")]
125        const FlexibleHeight = 1<<4;
126        #[doc(alias = "UIViewAutoresizingFlexibleBottomMargin")]
127        const FlexibleBottomMargin = 1<<5;
128    }
129}
130
131unsafe impl Encode for UIViewAutoresizing {
132    const ENCODING: Encoding = NSUInteger::ENCODING;
133}
134
135unsafe impl RefEncode for UIViewAutoresizing {
136    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
137}
138
139/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewanimationoptions?language=objc)
140// NS_OPTIONS
141#[repr(transparent)]
142#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
143pub struct UIViewAnimationOptions(pub NSUInteger);
144bitflags::bitflags! {
145    impl UIViewAnimationOptions: NSUInteger {
146        #[doc(alias = "UIViewAnimationOptionLayoutSubviews")]
147        const LayoutSubviews = 1<<0;
148        #[doc(alias = "UIViewAnimationOptionAllowUserInteraction")]
149        const AllowUserInteraction = 1<<1;
150        #[doc(alias = "UIViewAnimationOptionBeginFromCurrentState")]
151        const BeginFromCurrentState = 1<<2;
152        #[doc(alias = "UIViewAnimationOptionRepeat")]
153        const Repeat = 1<<3;
154        #[doc(alias = "UIViewAnimationOptionAutoreverse")]
155        const Autoreverse = 1<<4;
156        #[doc(alias = "UIViewAnimationOptionOverrideInheritedDuration")]
157        const OverrideInheritedDuration = 1<<5;
158        #[doc(alias = "UIViewAnimationOptionOverrideInheritedCurve")]
159        const OverrideInheritedCurve = 1<<6;
160        #[doc(alias = "UIViewAnimationOptionAllowAnimatedContent")]
161        const AllowAnimatedContent = 1<<7;
162        #[doc(alias = "UIViewAnimationOptionShowHideTransitionViews")]
163        const ShowHideTransitionViews = 1<<8;
164        #[doc(alias = "UIViewAnimationOptionOverrideInheritedOptions")]
165        const OverrideInheritedOptions = 1<<9;
166        #[doc(alias = "UIViewAnimationOptionCurveEaseInOut")]
167        const CurveEaseInOut = 0<<16;
168        #[doc(alias = "UIViewAnimationOptionCurveEaseIn")]
169        const CurveEaseIn = 1<<16;
170        #[doc(alias = "UIViewAnimationOptionCurveEaseOut")]
171        const CurveEaseOut = 2<<16;
172        #[doc(alias = "UIViewAnimationOptionCurveLinear")]
173        const CurveLinear = 3<<16;
174        #[doc(alias = "UIViewAnimationOptionTransitionNone")]
175        const TransitionNone = 0<<20;
176        #[doc(alias = "UIViewAnimationOptionTransitionFlipFromLeft")]
177        const TransitionFlipFromLeft = 1<<20;
178        #[doc(alias = "UIViewAnimationOptionTransitionFlipFromRight")]
179        const TransitionFlipFromRight = 2<<20;
180        #[doc(alias = "UIViewAnimationOptionTransitionCurlUp")]
181        const TransitionCurlUp = 3<<20;
182        #[doc(alias = "UIViewAnimationOptionTransitionCurlDown")]
183        const TransitionCurlDown = 4<<20;
184        #[doc(alias = "UIViewAnimationOptionTransitionCrossDissolve")]
185        const TransitionCrossDissolve = 5<<20;
186        #[doc(alias = "UIViewAnimationOptionTransitionFlipFromTop")]
187        const TransitionFlipFromTop = 6<<20;
188        #[doc(alias = "UIViewAnimationOptionTransitionFlipFromBottom")]
189        const TransitionFlipFromBottom = 7<<20;
190        #[doc(alias = "UIViewAnimationOptionPreferredFramesPerSecondDefault")]
191        const PreferredFramesPerSecondDefault = 0<<24;
192        #[doc(alias = "UIViewAnimationOptionPreferredFramesPerSecond60")]
193        const PreferredFramesPerSecond60 = 3<<24;
194        #[doc(alias = "UIViewAnimationOptionPreferredFramesPerSecond30")]
195        const PreferredFramesPerSecond30 = 7<<24;
196/// Flush all pending updates (including traits, properties, and layout) whenever the animation context changes.
197/// This includes flushing updates:
198/// - Before entering an animation scope, for invalidations that happened previously without animation.
199/// - Before entering a nested animation scope, for invalidations that happened in the outer animation scope.
200/// - Before exiting any animation scope, for invalidations that happened in that animation scope.
201/// - Before disabling animations, for invalidations that happened in the animation scope with animations enabled.
202/// - Before re-enabling animations, for invalidations that happened in the scope with animations disabled.
203/// This animation option implicitly applies to any nested animation scopes, even if they don't explicitly use this option.
204        #[doc(alias = "UIViewAnimationOptionFlushUpdates")]
205        const FlushUpdates = 1<<28;
206    }
207}
208
209unsafe impl Encode for UIViewAnimationOptions {
210    const ENCODING: Encoding = NSUInteger::ENCODING;
211}
212
213unsafe impl RefEncode for UIViewAnimationOptions {
214    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
215}
216
217/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewkeyframeanimationoptions?language=objc)
218// NS_OPTIONS
219#[repr(transparent)]
220#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
221pub struct UIViewKeyframeAnimationOptions(pub NSUInteger);
222bitflags::bitflags! {
223    impl UIViewKeyframeAnimationOptions: NSUInteger {
224        #[doc(alias = "UIViewKeyframeAnimationOptionLayoutSubviews")]
225        const LayoutSubviews = UIViewAnimationOptions::LayoutSubviews.0;
226        #[doc(alias = "UIViewKeyframeAnimationOptionAllowUserInteraction")]
227        const AllowUserInteraction = UIViewAnimationOptions::AllowUserInteraction.0;
228        #[doc(alias = "UIViewKeyframeAnimationOptionBeginFromCurrentState")]
229        const BeginFromCurrentState = UIViewAnimationOptions::BeginFromCurrentState.0;
230        #[doc(alias = "UIViewKeyframeAnimationOptionRepeat")]
231        const Repeat = UIViewAnimationOptions::Repeat.0;
232        #[doc(alias = "UIViewKeyframeAnimationOptionAutoreverse")]
233        const Autoreverse = UIViewAnimationOptions::Autoreverse.0;
234        #[doc(alias = "UIViewKeyframeAnimationOptionOverrideInheritedDuration")]
235        const OverrideInheritedDuration = UIViewAnimationOptions::OverrideInheritedDuration.0;
236        #[doc(alias = "UIViewKeyframeAnimationOptionOverrideInheritedOptions")]
237        const OverrideInheritedOptions = UIViewAnimationOptions::OverrideInheritedOptions.0;
238        #[doc(alias = "UIViewKeyframeAnimationOptionCalculationModeLinear")]
239        const CalculationModeLinear = 0<<10;
240        #[doc(alias = "UIViewKeyframeAnimationOptionCalculationModeDiscrete")]
241        const CalculationModeDiscrete = 1<<10;
242        #[doc(alias = "UIViewKeyframeAnimationOptionCalculationModePaced")]
243        const CalculationModePaced = 2<<10;
244        #[doc(alias = "UIViewKeyframeAnimationOptionCalculationModeCubic")]
245        const CalculationModeCubic = 3<<10;
246        #[doc(alias = "UIViewKeyframeAnimationOptionCalculationModeCubicPaced")]
247        const CalculationModeCubicPaced = 4<<10;
248    }
249}
250
251unsafe impl Encode for UIViewKeyframeAnimationOptions {
252    const ENCODING: Encoding = NSUInteger::ENCODING;
253}
254
255unsafe impl RefEncode for UIViewKeyframeAnimationOptions {
256    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
257}
258
259/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisystemanimation?language=objc)
260// NS_ENUM
261#[repr(transparent)]
262#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
263pub struct UISystemAnimation(pub NSUInteger);
264impl UISystemAnimation {
265    #[doc(alias = "UISystemAnimationDelete")]
266    pub const Delete: Self = Self(0);
267}
268
269unsafe impl Encode for UISystemAnimation {
270    const ENCODING: Encoding = NSUInteger::ENCODING;
271}
272
273unsafe impl RefEncode for UISystemAnimation {
274    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
275}
276
277/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewtintadjustmentmode?language=objc)
278// NS_ENUM
279#[repr(transparent)]
280#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
281pub struct UIViewTintAdjustmentMode(pub NSInteger);
282impl UIViewTintAdjustmentMode {
283    #[doc(alias = "UIViewTintAdjustmentModeAutomatic")]
284    pub const Automatic: Self = Self(0);
285    #[doc(alias = "UIViewTintAdjustmentModeNormal")]
286    pub const Normal: Self = Self(1);
287    #[doc(alias = "UIViewTintAdjustmentModeDimmed")]
288    pub const Dimmed: Self = Self(2);
289}
290
291unsafe impl Encode for UIViewTintAdjustmentMode {
292    const ENCODING: Encoding = NSInteger::ENCODING;
293}
294
295unsafe impl RefEncode for UIViewTintAdjustmentMode {
296    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
297}
298
299/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisemanticcontentattribute?language=objc)
300// NS_ENUM
301#[repr(transparent)]
302#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
303pub struct UISemanticContentAttribute(pub NSInteger);
304impl UISemanticContentAttribute {
305    #[doc(alias = "UISemanticContentAttributeUnspecified")]
306    pub const Unspecified: Self = Self(0);
307    #[doc(alias = "UISemanticContentAttributePlayback")]
308    pub const Playback: Self = Self(1);
309    #[doc(alias = "UISemanticContentAttributeSpatial")]
310    pub const Spatial: Self = Self(2);
311    #[doc(alias = "UISemanticContentAttributeForceLeftToRight")]
312    pub const ForceLeftToRight: Self = Self(3);
313    #[doc(alias = "UISemanticContentAttributeForceRightToLeft")]
314    pub const ForceRightToLeft: Self = Self(4);
315}
316
317unsafe impl Encode for UISemanticContentAttribute {
318    const ENCODING: Encoding = NSInteger::ENCODING;
319}
320
321unsafe impl RefEncode for UISemanticContentAttribute {
322    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
323}
324
325extern_class!(
326    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiview?language=objc)
327    #[unsafe(super(UIResponder, NSObject))]
328    #[thread_kind = MainThreadOnly]
329    #[derive(Debug, PartialEq, Eq, Hash)]
330    #[cfg(feature = "UIResponder")]
331    pub struct UIView;
332);
333
334#[cfg(all(feature = "UIResponder", feature = "objc2-quartz-core"))]
335#[cfg(not(target_os = "watchos"))]
336extern_conformance!(
337    unsafe impl CALayerDelegate for UIView {}
338);
339
340#[cfg(feature = "UIResponder")]
341extern_conformance!(
342    unsafe impl NSCoding for UIView {}
343);
344
345#[cfg(feature = "UIResponder")]
346extern_conformance!(
347    unsafe impl NSObjectProtocol for UIView {}
348);
349
350#[cfg(all(feature = "UIAppearance", feature = "UIResponder"))]
351extern_conformance!(
352    unsafe impl UIAppearance for UIView {}
353);
354
355#[cfg(all(feature = "UIAppearance", feature = "UIResponder"))]
356extern_conformance!(
357    unsafe impl UIAppearanceContainer for UIView {}
358);
359
360#[cfg(feature = "UIResponder")]
361extern_conformance!(
362    unsafe impl UICoordinateSpace for UIView {}
363);
364
365#[cfg(all(feature = "UIDynamicBehavior", feature = "UIResponder"))]
366extern_conformance!(
367    unsafe impl UIDynamicItem for UIView {}
368);
369
370#[cfg(all(feature = "UIFocus", feature = "UIResponder"))]
371extern_conformance!(
372    unsafe impl UIFocusEnvironment for UIView {}
373);
374
375#[cfg(all(feature = "UIFocus", feature = "UIResponder"))]
376extern_conformance!(
377    unsafe impl UIFocusItem for UIView {}
378);
379
380#[cfg(all(feature = "UIFocus", feature = "UIResponder"))]
381extern_conformance!(
382    unsafe impl UIFocusItemContainer for UIView {}
383);
384
385#[cfg(feature = "UIResponder")]
386extern_conformance!(
387    unsafe impl UIResponderStandardEditActions for UIView {}
388);
389
390#[cfg(all(feature = "UIResponder", feature = "UITraitCollection"))]
391extern_conformance!(
392    unsafe impl UITraitEnvironment for UIView {}
393);
394
395#[cfg(feature = "UIResponder")]
396impl UIView {
397    extern_methods!(
398        #[unsafe(method(layerClass))]
399        #[unsafe(method_family = none)]
400        pub fn layerClass(mtm: MainThreadMarker) -> &'static AnyClass;
401
402        #[cfg(feature = "objc2-core-foundation")]
403        #[unsafe(method(initWithFrame:))]
404        #[unsafe(method_family = init)]
405        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
406
407        /// # Safety
408        ///
409        /// `coder` possibly has further requirements.
410        #[unsafe(method(initWithCoder:))]
411        #[unsafe(method_family = init)]
412        pub unsafe fn initWithCoder(
413            this: Allocated<Self>,
414            coder: &NSCoder,
415        ) -> Option<Retained<Self>>;
416
417        #[unsafe(method(init))]
418        #[unsafe(method_family = init)]
419        pub fn init(this: Allocated<Self>) -> Retained<Self>;
420
421        #[unsafe(method(isUserInteractionEnabled))]
422        #[unsafe(method_family = none)]
423        pub fn isUserInteractionEnabled(&self) -> bool;
424
425        /// Setter for [`isUserInteractionEnabled`][Self::isUserInteractionEnabled].
426        #[unsafe(method(setUserInteractionEnabled:))]
427        #[unsafe(method_family = none)]
428        pub fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);
429
430        #[unsafe(method(tag))]
431        #[unsafe(method_family = none)]
432        pub fn tag(&self) -> NSInteger;
433
434        /// Setter for [`tag`][Self::tag].
435        #[unsafe(method(setTag:))]
436        #[unsafe(method_family = none)]
437        pub fn setTag(&self, tag: NSInteger);
438
439        #[cfg(feature = "objc2-quartz-core")]
440        #[cfg(not(target_os = "watchos"))]
441        #[unsafe(method(layer))]
442        #[unsafe(method_family = none)]
443        pub fn layer(&self) -> Retained<CALayer>;
444
445        #[unsafe(method(canBecomeFocused))]
446        #[unsafe(method_family = none)]
447        pub fn canBecomeFocused(&self) -> bool;
448
449        #[unsafe(method(isFocused))]
450        #[unsafe(method_family = none)]
451        pub fn isFocused(&self) -> bool;
452
453        /// The identifier of the focus group that this view belongs to. If this is nil, subviews inherit their superview's focus group.
454        #[unsafe(method(focusGroupIdentifier))]
455        #[unsafe(method_family = none)]
456        pub fn focusGroupIdentifier(&self) -> Option<Retained<NSString>>;
457
458        /// Setter for [`focusGroupIdentifier`][Self::focusGroupIdentifier].
459        ///
460        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
461        #[unsafe(method(setFocusGroupIdentifier:))]
462        #[unsafe(method_family = none)]
463        pub fn setFocusGroupIdentifier(&self, focus_group_identifier: Option<&NSString>);
464
465        #[cfg(feature = "UIFocus")]
466        /// The priority this item has in its focus group. The higher the priority, the more likely it is to get picked when focus moves into this group.
467        /// Note: this method can only be used to increase an item's priority, not decrease it. For example if an item is currently selected, the actual priority of this item will be determined by MAX(focusGroupPriority, UIFocusGroupPrioritySelected).
468        #[unsafe(method(focusGroupPriority))]
469        #[unsafe(method_family = none)]
470        pub fn focusGroupPriority(&self) -> UIFocusGroupPriority;
471
472        #[cfg(feature = "UIFocus")]
473        /// Setter for [`focusGroupPriority`][Self::focusGroupPriority].
474        #[unsafe(method(setFocusGroupPriority:))]
475        #[unsafe(method_family = none)]
476        pub fn setFocusGroupPriority(&self, focus_group_priority: UIFocusGroupPriority);
477
478        #[cfg(feature = "UIFocusEffect")]
479        /// Describes a visual effect to apply when this item is focused. If this property is nil no effect will be applied when this view becomes focused.
480        #[unsafe(method(focusEffect))]
481        #[unsafe(method_family = none)]
482        pub fn focusEffect(&self) -> Option<Retained<UIFocusEffect>>;
483
484        #[cfg(feature = "UIFocusEffect")]
485        /// Setter for [`focusEffect`][Self::focusEffect].
486        ///
487        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
488        #[unsafe(method(setFocusEffect:))]
489        #[unsafe(method_family = none)]
490        pub fn setFocusEffect(&self, focus_effect: Option<&UIFocusEffect>);
491
492        #[unsafe(method(semanticContentAttribute))]
493        #[unsafe(method_family = none)]
494        pub fn semanticContentAttribute(&self) -> UISemanticContentAttribute;
495
496        /// Setter for [`semanticContentAttribute`][Self::semanticContentAttribute].
497        #[unsafe(method(setSemanticContentAttribute:))]
498        #[unsafe(method_family = none)]
499        pub fn setSemanticContentAttribute(
500            &self,
501            semantic_content_attribute: UISemanticContentAttribute,
502        );
503
504        #[cfg(feature = "UIInterface")]
505        #[unsafe(method(userInterfaceLayoutDirectionForSemanticContentAttribute:))]
506        #[unsafe(method_family = none)]
507        pub fn userInterfaceLayoutDirectionForSemanticContentAttribute(
508            attribute: UISemanticContentAttribute,
509            mtm: MainThreadMarker,
510        ) -> UIUserInterfaceLayoutDirection;
511
512        #[cfg(feature = "UIInterface")]
513        #[unsafe(method(userInterfaceLayoutDirectionForSemanticContentAttribute:relativeToLayoutDirection:))]
514        #[unsafe(method_family = none)]
515        pub fn userInterfaceLayoutDirectionForSemanticContentAttribute_relativeToLayoutDirection(
516            semantic_content_attribute: UISemanticContentAttribute,
517            layout_direction: UIUserInterfaceLayoutDirection,
518            mtm: MainThreadMarker,
519        ) -> UIUserInterfaceLayoutDirection;
520
521        #[cfg(feature = "UIInterface")]
522        #[unsafe(method(effectiveUserInterfaceLayoutDirection))]
523        #[unsafe(method_family = none)]
524        pub fn effectiveUserInterfaceLayoutDirection(&self) -> UIUserInterfaceLayoutDirection;
525    );
526}
527
528/// Methods declared on superclass `NSObject`.
529#[cfg(feature = "UIResponder")]
530impl UIView {
531    extern_methods!(
532        #[unsafe(method(new))]
533        #[unsafe(method_family = new)]
534        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
535    );
536}
537
538/// UIViewGeometry.
539#[cfg(feature = "UIResponder")]
540impl UIView {
541    extern_methods!(
542        #[cfg(feature = "objc2-core-foundation")]
543        #[unsafe(method(frame))]
544        #[unsafe(method_family = none)]
545        pub fn frame(&self) -> CGRect;
546
547        #[cfg(feature = "objc2-core-foundation")]
548        /// Setter for [`frame`][Self::frame].
549        #[unsafe(method(setFrame:))]
550        #[unsafe(method_family = none)]
551        pub fn setFrame(&self, frame: CGRect);
552
553        #[cfg(feature = "objc2-core-foundation")]
554        #[unsafe(method(bounds))]
555        #[unsafe(method_family = none)]
556        pub fn bounds(&self) -> CGRect;
557
558        #[cfg(feature = "objc2-core-foundation")]
559        /// Setter for [`bounds`][Self::bounds].
560        #[unsafe(method(setBounds:))]
561        #[unsafe(method_family = none)]
562        pub fn setBounds(&self, bounds: CGRect);
563
564        #[cfg(feature = "objc2-core-foundation")]
565        #[unsafe(method(center))]
566        #[unsafe(method_family = none)]
567        pub fn center(&self) -> CGPoint;
568
569        #[cfg(feature = "objc2-core-foundation")]
570        /// Setter for [`center`][Self::center].
571        #[unsafe(method(setCenter:))]
572        #[unsafe(method_family = none)]
573        pub fn setCenter(&self, center: CGPoint);
574
575        #[cfg(feature = "objc2-core-foundation")]
576        #[unsafe(method(transform))]
577        #[unsafe(method_family = none)]
578        pub fn transform(&self) -> CGAffineTransform;
579
580        #[cfg(feature = "objc2-core-foundation")]
581        /// Setter for [`transform`][Self::transform].
582        #[unsafe(method(setTransform:))]
583        #[unsafe(method_family = none)]
584        pub fn setTransform(&self, transform: CGAffineTransform);
585
586        #[cfg(feature = "objc2-quartz-core")]
587        #[cfg(not(target_os = "watchos"))]
588        #[unsafe(method(transform3D))]
589        #[unsafe(method_family = none)]
590        pub fn transform3D(&self) -> CATransform3D;
591
592        #[cfg(feature = "objc2-quartz-core")]
593        #[cfg(not(target_os = "watchos"))]
594        /// Setter for [`transform3D`][Self::transform3D].
595        #[unsafe(method(setTransform3D:))]
596        #[unsafe(method_family = none)]
597        pub fn setTransform3D(&self, transform3_d: CATransform3D);
598
599        #[cfg(feature = "objc2-core-foundation")]
600        #[unsafe(method(contentScaleFactor))]
601        #[unsafe(method_family = none)]
602        pub fn contentScaleFactor(&self) -> CGFloat;
603
604        #[cfg(feature = "objc2-core-foundation")]
605        /// Setter for [`contentScaleFactor`][Self::contentScaleFactor].
606        #[unsafe(method(setContentScaleFactor:))]
607        #[unsafe(method_family = none)]
608        pub fn setContentScaleFactor(&self, content_scale_factor: CGFloat);
609
610        #[cfg(feature = "objc2-core-foundation")]
611        #[unsafe(method(anchorPoint))]
612        #[unsafe(method_family = none)]
613        pub fn anchorPoint(&self) -> CGPoint;
614
615        #[cfg(feature = "objc2-core-foundation")]
616        /// Setter for [`anchorPoint`][Self::anchorPoint].
617        #[unsafe(method(setAnchorPoint:))]
618        #[unsafe(method_family = none)]
619        pub fn setAnchorPoint(&self, anchor_point: CGPoint);
620
621        #[unsafe(method(isMultipleTouchEnabled))]
622        #[unsafe(method_family = none)]
623        pub fn isMultipleTouchEnabled(&self) -> bool;
624
625        /// Setter for [`isMultipleTouchEnabled`][Self::isMultipleTouchEnabled].
626        #[unsafe(method(setMultipleTouchEnabled:))]
627        #[unsafe(method_family = none)]
628        pub fn setMultipleTouchEnabled(&self, multiple_touch_enabled: bool);
629
630        #[unsafe(method(isExclusiveTouch))]
631        #[unsafe(method_family = none)]
632        pub fn isExclusiveTouch(&self) -> bool;
633
634        /// Setter for [`isExclusiveTouch`][Self::isExclusiveTouch].
635        #[unsafe(method(setExclusiveTouch:))]
636        #[unsafe(method_family = none)]
637        pub fn setExclusiveTouch(&self, exclusive_touch: bool);
638
639        #[cfg(all(feature = "UIEvent", feature = "objc2-core-foundation"))]
640        #[unsafe(method(hitTest:withEvent:))]
641        #[unsafe(method_family = none)]
642        pub fn hitTest_withEvent(
643            &self,
644            point: CGPoint,
645            event: Option<&UIEvent>,
646        ) -> Option<Retained<UIView>>;
647
648        #[cfg(all(feature = "UIEvent", feature = "objc2-core-foundation"))]
649        #[unsafe(method(pointInside:withEvent:))]
650        #[unsafe(method_family = none)]
651        pub fn pointInside_withEvent(&self, point: CGPoint, event: Option<&UIEvent>) -> bool;
652
653        #[cfg(feature = "objc2-core-foundation")]
654        #[unsafe(method(convertPoint:toView:))]
655        #[unsafe(method_family = none)]
656        pub fn convertPoint_toView(&self, point: CGPoint, view: Option<&UIView>) -> CGPoint;
657
658        #[cfg(feature = "objc2-core-foundation")]
659        #[unsafe(method(convertPoint:fromView:))]
660        #[unsafe(method_family = none)]
661        pub fn convertPoint_fromView(&self, point: CGPoint, view: Option<&UIView>) -> CGPoint;
662
663        #[cfg(feature = "objc2-core-foundation")]
664        #[unsafe(method(convertRect:toView:))]
665        #[unsafe(method_family = none)]
666        pub fn convertRect_toView(&self, rect: CGRect, view: Option<&UIView>) -> CGRect;
667
668        #[cfg(feature = "objc2-core-foundation")]
669        #[unsafe(method(convertRect:fromView:))]
670        #[unsafe(method_family = none)]
671        pub fn convertRect_fromView(&self, rect: CGRect, view: Option<&UIView>) -> CGRect;
672
673        #[unsafe(method(autoresizesSubviews))]
674        #[unsafe(method_family = none)]
675        pub fn autoresizesSubviews(&self) -> bool;
676
677        /// Setter for [`autoresizesSubviews`][Self::autoresizesSubviews].
678        #[unsafe(method(setAutoresizesSubviews:))]
679        #[unsafe(method_family = none)]
680        pub fn setAutoresizesSubviews(&self, autoresizes_subviews: bool);
681
682        #[unsafe(method(autoresizingMask))]
683        #[unsafe(method_family = none)]
684        pub fn autoresizingMask(&self) -> UIViewAutoresizing;
685
686        /// Setter for [`autoresizingMask`][Self::autoresizingMask].
687        #[unsafe(method(setAutoresizingMask:))]
688        #[unsafe(method_family = none)]
689        pub fn setAutoresizingMask(&self, autoresizing_mask: UIViewAutoresizing);
690
691        #[cfg(feature = "objc2-core-foundation")]
692        #[unsafe(method(sizeThatFits:))]
693        #[unsafe(method_family = none)]
694        pub fn sizeThatFits(&self, size: CGSize) -> CGSize;
695
696        #[unsafe(method(sizeToFit))]
697        #[unsafe(method_family = none)]
698        pub fn sizeToFit(&self);
699    );
700}
701
702/// UIViewHierarchy.
703#[cfg(feature = "UIResponder")]
704impl UIView {
705    extern_methods!(
706        #[unsafe(method(superview))]
707        #[unsafe(method_family = none)]
708        pub fn superview(&self) -> Option<Retained<UIView>>;
709
710        #[unsafe(method(subviews))]
711        #[unsafe(method_family = none)]
712        pub fn subviews(&self) -> Retained<NSArray<UIView>>;
713
714        #[cfg(feature = "UIWindow")]
715        #[unsafe(method(window))]
716        #[unsafe(method_family = none)]
717        pub fn window(&self) -> Option<Retained<UIWindow>>;
718
719        #[unsafe(method(removeFromSuperview))]
720        #[unsafe(method_family = none)]
721        pub fn removeFromSuperview(&self);
722
723        #[unsafe(method(insertSubview:atIndex:))]
724        #[unsafe(method_family = none)]
725        pub fn insertSubview_atIndex(&self, view: &UIView, index: NSInteger);
726
727        #[unsafe(method(exchangeSubviewAtIndex:withSubviewAtIndex:))]
728        #[unsafe(method_family = none)]
729        pub fn exchangeSubviewAtIndex_withSubviewAtIndex(
730            &self,
731            index1: NSInteger,
732            index2: NSInteger,
733        );
734
735        #[unsafe(method(addSubview:))]
736        #[unsafe(method_family = none)]
737        pub fn addSubview(&self, view: &UIView);
738
739        #[unsafe(method(insertSubview:belowSubview:))]
740        #[unsafe(method_family = none)]
741        pub fn insertSubview_belowSubview(&self, view: &UIView, sibling_subview: &UIView);
742
743        #[unsafe(method(insertSubview:aboveSubview:))]
744        #[unsafe(method_family = none)]
745        pub fn insertSubview_aboveSubview(&self, view: &UIView, sibling_subview: &UIView);
746
747        #[unsafe(method(bringSubviewToFront:))]
748        #[unsafe(method_family = none)]
749        pub fn bringSubviewToFront(&self, view: &UIView);
750
751        #[unsafe(method(sendSubviewToBack:))]
752        #[unsafe(method_family = none)]
753        pub fn sendSubviewToBack(&self, view: &UIView);
754
755        #[unsafe(method(didAddSubview:))]
756        #[unsafe(method_family = none)]
757        pub fn didAddSubview(&self, subview: &UIView);
758
759        #[unsafe(method(willRemoveSubview:))]
760        #[unsafe(method_family = none)]
761        pub fn willRemoveSubview(&self, subview: &UIView);
762
763        #[unsafe(method(willMoveToSuperview:))]
764        #[unsafe(method_family = none)]
765        pub fn willMoveToSuperview(&self, new_superview: Option<&UIView>);
766
767        #[unsafe(method(didMoveToSuperview))]
768        #[unsafe(method_family = none)]
769        pub fn didMoveToSuperview(&self);
770
771        #[cfg(feature = "UIWindow")]
772        #[unsafe(method(willMoveToWindow:))]
773        #[unsafe(method_family = none)]
774        pub fn willMoveToWindow(&self, new_window: Option<&UIWindow>);
775
776        #[unsafe(method(didMoveToWindow))]
777        #[unsafe(method_family = none)]
778        pub fn didMoveToWindow(&self);
779
780        #[unsafe(method(isDescendantOfView:))]
781        #[unsafe(method_family = none)]
782        pub fn isDescendantOfView(&self, view: &UIView) -> bool;
783
784        #[unsafe(method(viewWithTag:))]
785        #[unsafe(method_family = none)]
786        pub fn viewWithTag(&self, tag: NSInteger) -> Option<Retained<UIView>>;
787
788        /// Call to manually request a properties update for the view.
789        /// Multiple requests may be coalesced into a single update alongside the next layout pass.
790        #[unsafe(method(setNeedsUpdateProperties))]
791        #[unsafe(method_family = none)]
792        pub fn setNeedsUpdateProperties(&self);
793
794        /// Override point for subclasses to update properties of this view.
795        /// Never call this method directly; use `setNeedsUpdateProperties` to schedule an update.
796        #[unsafe(method(updateProperties))]
797        #[unsafe(method_family = none)]
798        pub fn updateProperties(&self);
799
800        /// Forces an immediate properties update for this view (and its view controller, if applicable)
801        /// and any subviews, including any view controllers or views in its subtree.
802        #[unsafe(method(updatePropertiesIfNeeded))]
803        #[unsafe(method_family = none)]
804        pub fn updatePropertiesIfNeeded(&self);
805
806        #[unsafe(method(setNeedsLayout))]
807        #[unsafe(method_family = none)]
808        pub fn setNeedsLayout(&self);
809
810        #[unsafe(method(layoutIfNeeded))]
811        #[unsafe(method_family = none)]
812        pub fn layoutIfNeeded(&self);
813
814        #[unsafe(method(layoutSubviews))]
815        #[unsafe(method_family = none)]
816        pub fn layoutSubviews(&self);
817
818        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
819        #[unsafe(method(layoutMargins))]
820        #[unsafe(method_family = none)]
821        pub fn layoutMargins(&self) -> UIEdgeInsets;
822
823        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
824        /// Setter for [`layoutMargins`][Self::layoutMargins].
825        #[unsafe(method(setLayoutMargins:))]
826        #[unsafe(method_family = none)]
827        pub fn setLayoutMargins(&self, layout_margins: UIEdgeInsets);
828
829        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
830        #[unsafe(method(directionalLayoutMargins))]
831        #[unsafe(method_family = none)]
832        pub fn directionalLayoutMargins(&self) -> NSDirectionalEdgeInsets;
833
834        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
835        /// Setter for [`directionalLayoutMargins`][Self::directionalLayoutMargins].
836        #[unsafe(method(setDirectionalLayoutMargins:))]
837        #[unsafe(method_family = none)]
838        pub fn setDirectionalLayoutMargins(
839            &self,
840            directional_layout_margins: NSDirectionalEdgeInsets,
841        );
842
843        #[unsafe(method(preservesSuperviewLayoutMargins))]
844        #[unsafe(method_family = none)]
845        pub fn preservesSuperviewLayoutMargins(&self) -> bool;
846
847        /// Setter for [`preservesSuperviewLayoutMargins`][Self::preservesSuperviewLayoutMargins].
848        #[unsafe(method(setPreservesSuperviewLayoutMargins:))]
849        #[unsafe(method_family = none)]
850        pub fn setPreservesSuperviewLayoutMargins(&self, preserves_superview_layout_margins: bool);
851
852        #[unsafe(method(insetsLayoutMarginsFromSafeArea))]
853        #[unsafe(method_family = none)]
854        pub fn insetsLayoutMarginsFromSafeArea(&self) -> bool;
855
856        /// Setter for [`insetsLayoutMarginsFromSafeArea`][Self::insetsLayoutMarginsFromSafeArea].
857        #[unsafe(method(setInsetsLayoutMarginsFromSafeArea:))]
858        #[unsafe(method_family = none)]
859        pub fn setInsetsLayoutMarginsFromSafeArea(
860            &self,
861            insets_layout_margins_from_safe_area: bool,
862        );
863
864        #[unsafe(method(layoutMarginsDidChange))]
865        #[unsafe(method_family = none)]
866        pub fn layoutMarginsDidChange(&self);
867
868        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
869        #[unsafe(method(safeAreaInsets))]
870        #[unsafe(method_family = none)]
871        pub fn safeAreaInsets(&self) -> UIEdgeInsets;
872
873        #[unsafe(method(safeAreaInsetsDidChange))]
874        #[unsafe(method_family = none)]
875        pub fn safeAreaInsetsDidChange(&self);
876
877        #[cfg(feature = "UILayoutGuide")]
878        #[unsafe(method(layoutMarginsGuide))]
879        #[unsafe(method_family = none)]
880        pub fn layoutMarginsGuide(&self) -> Retained<UILayoutGuide>;
881
882        #[cfg(feature = "UILayoutGuide")]
883        /// This content guide provides a layout area that you can use to place text and related content whose width should generally be constrained to a size that is easy for the user to read. This guide provides a centered region that you can place content within to get this behavior for this view.
884        #[unsafe(method(readableContentGuide))]
885        #[unsafe(method_family = none)]
886        pub fn readableContentGuide(&self) -> Retained<UILayoutGuide>;
887
888        #[cfg(feature = "UILayoutGuide")]
889        #[unsafe(method(safeAreaLayoutGuide))]
890        #[unsafe(method_family = none)]
891        pub fn safeAreaLayoutGuide(&self) -> Retained<UILayoutGuide>;
892
893        #[cfg(all(
894            feature = "UIKeyboardLayoutGuide",
895            feature = "UILayoutGuide",
896            feature = "UITrackingLayoutGuide"
897        ))]
898        /// Follows the keyboard when on screen and docked. See UIKeyboardLayoutGuide.h for additional options.
899        #[unsafe(method(keyboardLayoutGuide))]
900        #[unsafe(method_family = none)]
901        pub fn keyboardLayoutGuide(&self) -> Retained<UIKeyboardLayoutGuide>;
902    );
903}
904
905/// UIViewRendering.
906#[cfg(feature = "UIResponder")]
907impl UIView {
908    extern_methods!(
909        #[cfg(feature = "objc2-core-foundation")]
910        #[unsafe(method(drawRect:))]
911        #[unsafe(method_family = none)]
912        pub fn drawRect(&self, rect: CGRect);
913
914        #[unsafe(method(setNeedsDisplay))]
915        #[unsafe(method_family = none)]
916        pub fn setNeedsDisplay(&self);
917
918        #[cfg(feature = "objc2-core-foundation")]
919        #[unsafe(method(setNeedsDisplayInRect:))]
920        #[unsafe(method_family = none)]
921        pub fn setNeedsDisplayInRect(&self, rect: CGRect);
922
923        #[unsafe(method(clipsToBounds))]
924        #[unsafe(method_family = none)]
925        pub fn clipsToBounds(&self) -> bool;
926
927        /// Setter for [`clipsToBounds`][Self::clipsToBounds].
928        #[unsafe(method(setClipsToBounds:))]
929        #[unsafe(method_family = none)]
930        pub fn setClipsToBounds(&self, clips_to_bounds: bool);
931
932        #[cfg(feature = "UIColor")]
933        #[unsafe(method(backgroundColor))]
934        #[unsafe(method_family = none)]
935        pub fn backgroundColor(&self) -> Option<Retained<UIColor>>;
936
937        #[cfg(feature = "UIColor")]
938        /// Setter for [`backgroundColor`][Self::backgroundColor].
939        ///
940        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
941        #[unsafe(method(setBackgroundColor:))]
942        #[unsafe(method_family = none)]
943        pub fn setBackgroundColor(&self, background_color: Option<&UIColor>);
944
945        #[cfg(feature = "objc2-core-foundation")]
946        #[unsafe(method(alpha))]
947        #[unsafe(method_family = none)]
948        pub fn alpha(&self) -> CGFloat;
949
950        #[cfg(feature = "objc2-core-foundation")]
951        /// Setter for [`alpha`][Self::alpha].
952        #[unsafe(method(setAlpha:))]
953        #[unsafe(method_family = none)]
954        pub fn setAlpha(&self, alpha: CGFloat);
955
956        #[unsafe(method(isOpaque))]
957        #[unsafe(method_family = none)]
958        pub fn isOpaque(&self) -> bool;
959
960        /// Setter for [`isOpaque`][Self::isOpaque].
961        #[unsafe(method(setOpaque:))]
962        #[unsafe(method_family = none)]
963        pub fn setOpaque(&self, opaque: bool);
964
965        #[unsafe(method(clearsContextBeforeDrawing))]
966        #[unsafe(method_family = none)]
967        pub fn clearsContextBeforeDrawing(&self) -> bool;
968
969        /// Setter for [`clearsContextBeforeDrawing`][Self::clearsContextBeforeDrawing].
970        #[unsafe(method(setClearsContextBeforeDrawing:))]
971        #[unsafe(method_family = none)]
972        pub fn setClearsContextBeforeDrawing(&self, clears_context_before_drawing: bool);
973
974        #[unsafe(method(isHidden))]
975        #[unsafe(method_family = none)]
976        pub fn isHidden(&self) -> bool;
977
978        /// Setter for [`isHidden`][Self::isHidden].
979        #[unsafe(method(setHidden:))]
980        #[unsafe(method_family = none)]
981        pub fn setHidden(&self, hidden: bool);
982
983        #[unsafe(method(contentMode))]
984        #[unsafe(method_family = none)]
985        pub fn contentMode(&self) -> UIViewContentMode;
986
987        /// Setter for [`contentMode`][Self::contentMode].
988        #[unsafe(method(setContentMode:))]
989        #[unsafe(method_family = none)]
990        pub fn setContentMode(&self, content_mode: UIViewContentMode);
991
992        #[cfg(feature = "objc2-core-foundation")]
993        #[deprecated]
994        #[unsafe(method(contentStretch))]
995        #[unsafe(method_family = none)]
996        pub fn contentStretch(&self) -> CGRect;
997
998        #[cfg(feature = "objc2-core-foundation")]
999        /// Setter for [`contentStretch`][Self::contentStretch].
1000        #[deprecated]
1001        #[unsafe(method(setContentStretch:))]
1002        #[unsafe(method_family = none)]
1003        pub fn setContentStretch(&self, content_stretch: CGRect);
1004
1005        #[unsafe(method(maskView))]
1006        #[unsafe(method_family = none)]
1007        pub fn maskView(&self) -> Option<Retained<UIView>>;
1008
1009        /// Setter for [`maskView`][Self::maskView].
1010        #[unsafe(method(setMaskView:))]
1011        #[unsafe(method_family = none)]
1012        pub fn setMaskView(&self, mask_view: Option<&UIView>);
1013
1014        #[cfg(feature = "UIColor")]
1015        #[unsafe(method(tintColor))]
1016        #[unsafe(method_family = none)]
1017        pub fn tintColor(&self) -> Option<Retained<UIColor>>;
1018
1019        #[cfg(feature = "UIColor")]
1020        /// Setter for [`tintColor`][Self::tintColor].
1021        ///
1022        /// # Safety
1023        ///
1024        /// `tint_color` might not allow `None`.
1025        #[unsafe(method(setTintColor:))]
1026        #[unsafe(method_family = none)]
1027        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
1028
1029        #[unsafe(method(tintAdjustmentMode))]
1030        #[unsafe(method_family = none)]
1031        pub fn tintAdjustmentMode(&self) -> UIViewTintAdjustmentMode;
1032
1033        /// Setter for [`tintAdjustmentMode`][Self::tintAdjustmentMode].
1034        #[unsafe(method(setTintAdjustmentMode:))]
1035        #[unsafe(method_family = none)]
1036        pub fn setTintAdjustmentMode(&self, tint_adjustment_mode: UIViewTintAdjustmentMode);
1037
1038        #[unsafe(method(tintColorDidChange))]
1039        #[unsafe(method_family = none)]
1040        pub fn tintColorDidChange(&self);
1041    );
1042}
1043
1044/// UIViewAnimation.
1045#[cfg(feature = "UIResponder")]
1046impl UIView {
1047    extern_methods!(
1048        #[unsafe(method(setAnimationsEnabled:))]
1049        #[unsafe(method_family = none)]
1050        pub fn setAnimationsEnabled(enabled: bool, mtm: MainThreadMarker);
1051
1052        #[unsafe(method(areAnimationsEnabled))]
1053        #[unsafe(method_family = none)]
1054        pub fn areAnimationsEnabled(mtm: MainThreadMarker) -> bool;
1055
1056        #[cfg(feature = "block2")]
1057        #[unsafe(method(performWithoutAnimation:))]
1058        #[unsafe(method_family = none)]
1059        pub fn performWithoutAnimation(
1060            actions_without_animation: &block2::DynBlock<dyn Fn() + '_>,
1061            mtm: MainThreadMarker,
1062        );
1063
1064        #[unsafe(method(inheritedAnimationDuration))]
1065        #[unsafe(method_family = none)]
1066        pub fn inheritedAnimationDuration(mtm: MainThreadMarker) -> NSTimeInterval;
1067    );
1068}
1069
1070/// UIViewAnimationWithBlocks.
1071#[cfg(feature = "UIResponder")]
1072impl UIView {
1073    extern_methods!(
1074        #[cfg(feature = "block2")]
1075        #[unsafe(method(animateWithDuration:delay:options:animations:completion:))]
1076        #[unsafe(method_family = none)]
1077        pub fn animateWithDuration_delay_options_animations_completion(
1078            duration: NSTimeInterval,
1079            delay: NSTimeInterval,
1080            options: UIViewAnimationOptions,
1081            animations: &block2::DynBlock<dyn Fn()>,
1082            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
1083            mtm: MainThreadMarker,
1084        );
1085
1086        #[cfg(feature = "block2")]
1087        #[unsafe(method(animateWithDuration:animations:completion:))]
1088        #[unsafe(method_family = none)]
1089        pub fn animateWithDuration_animations_completion(
1090            duration: NSTimeInterval,
1091            animations: &block2::DynBlock<dyn Fn()>,
1092            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
1093            mtm: MainThreadMarker,
1094        );
1095
1096        #[cfg(feature = "block2")]
1097        #[unsafe(method(animateWithDuration:animations:))]
1098        #[unsafe(method_family = none)]
1099        pub fn animateWithDuration_animations(
1100            duration: NSTimeInterval,
1101            animations: &block2::DynBlock<dyn Fn()>,
1102            mtm: MainThreadMarker,
1103        );
1104
1105        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
1106        #[unsafe(method(animateWithSpringDuration:bounce:initialSpringVelocity:delay:options:animations:completion:))]
1107        #[unsafe(method_family = none)]
1108        pub fn animateWithSpringDuration_bounce_initialSpringVelocity_delay_options_animations_completion(
1109            duration: NSTimeInterval,
1110            bounce: CGFloat,
1111            velocity: CGFloat,
1112            delay: NSTimeInterval,
1113            options: UIViewAnimationOptions,
1114            animations: &block2::DynBlock<dyn Fn() + '_>,
1115            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
1116            mtm: MainThreadMarker,
1117        );
1118
1119        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
1120        #[unsafe(method(animateWithDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:))]
1121        #[unsafe(method_family = none)]
1122        pub fn animateWithDuration_delay_usingSpringWithDamping_initialSpringVelocity_options_animations_completion(
1123            duration: NSTimeInterval,
1124            delay: NSTimeInterval,
1125            damping_ratio: CGFloat,
1126            velocity: CGFloat,
1127            options: UIViewAnimationOptions,
1128            animations: &block2::DynBlock<dyn Fn()>,
1129            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
1130            mtm: MainThreadMarker,
1131        );
1132
1133        #[cfg(feature = "block2")]
1134        #[unsafe(method(transitionWithView:duration:options:animations:completion:))]
1135        #[unsafe(method_family = none)]
1136        pub fn transitionWithView_duration_options_animations_completion(
1137            view: &UIView,
1138            duration: NSTimeInterval,
1139            options: UIViewAnimationOptions,
1140            animations: Option<&block2::DynBlock<dyn Fn()>>,
1141            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
1142        );
1143
1144        #[cfg(feature = "block2")]
1145        #[unsafe(method(transitionFromView:toView:duration:options:completion:))]
1146        #[unsafe(method_family = none)]
1147        pub fn transitionFromView_toView_duration_options_completion(
1148            from_view: &UIView,
1149            to_view: &UIView,
1150            duration: NSTimeInterval,
1151            options: UIViewAnimationOptions,
1152            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
1153        );
1154
1155        #[cfg(feature = "block2")]
1156        #[unsafe(method(performSystemAnimation:onViews:options:animations:completion:))]
1157        #[unsafe(method_family = none)]
1158        pub fn performSystemAnimation_onViews_options_animations_completion(
1159            animation: UISystemAnimation,
1160            views: &NSArray<UIView>,
1161            options: UIViewAnimationOptions,
1162            parallel_animations: Option<&block2::DynBlock<dyn Fn()>>,
1163            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
1164            mtm: MainThreadMarker,
1165        );
1166
1167        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
1168        #[unsafe(method(modifyAnimationsWithRepeatCount:autoreverses:animations:))]
1169        #[unsafe(method_family = none)]
1170        pub fn modifyAnimationsWithRepeatCount_autoreverses_animations(
1171            count: CGFloat,
1172            autoreverses: bool,
1173            animations: &block2::DynBlock<dyn Fn() + '_>,
1174            mtm: MainThreadMarker,
1175        );
1176    );
1177}
1178
1179/// UIViewKeyframeAnimations.
1180#[cfg(feature = "UIResponder")]
1181impl UIView {
1182    extern_methods!(
1183        #[cfg(feature = "block2")]
1184        #[unsafe(method(animateKeyframesWithDuration:delay:options:animations:completion:))]
1185        #[unsafe(method_family = none)]
1186        pub fn animateKeyframesWithDuration_delay_options_animations_completion(
1187            duration: NSTimeInterval,
1188            delay: NSTimeInterval,
1189            options: UIViewKeyframeAnimationOptions,
1190            animations: &block2::DynBlock<dyn Fn()>,
1191            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
1192            mtm: MainThreadMarker,
1193        );
1194
1195        #[cfg(feature = "block2")]
1196        #[unsafe(method(addKeyframeWithRelativeStartTime:relativeDuration:animations:))]
1197        #[unsafe(method_family = none)]
1198        pub fn addKeyframeWithRelativeStartTime_relativeDuration_animations(
1199            frame_start_time: c_double,
1200            frame_duration: c_double,
1201            animations: &block2::DynBlock<dyn Fn()>,
1202            mtm: MainThreadMarker,
1203        );
1204    );
1205}
1206
1207/// UIViewGestureRecognizers.
1208#[cfg(feature = "UIResponder")]
1209impl UIView {
1210    extern_methods!(
1211        #[cfg(feature = "UIGestureRecognizer")]
1212        #[unsafe(method(gestureRecognizers))]
1213        #[unsafe(method_family = none)]
1214        pub fn gestureRecognizers(&self) -> Option<Retained<NSArray<UIGestureRecognizer>>>;
1215
1216        #[cfg(feature = "UIGestureRecognizer")]
1217        /// Setter for [`gestureRecognizers`][Self::gestureRecognizers].
1218        ///
1219        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1220        #[unsafe(method(setGestureRecognizers:))]
1221        #[unsafe(method_family = none)]
1222        pub fn setGestureRecognizers(
1223            &self,
1224            gesture_recognizers: Option<&NSArray<UIGestureRecognizer>>,
1225        );
1226
1227        #[cfg(feature = "UIGestureRecognizer")]
1228        #[unsafe(method(addGestureRecognizer:))]
1229        #[unsafe(method_family = none)]
1230        pub fn addGestureRecognizer(&self, gesture_recognizer: &UIGestureRecognizer);
1231
1232        #[cfg(feature = "UIGestureRecognizer")]
1233        #[unsafe(method(removeGestureRecognizer:))]
1234        #[unsafe(method_family = none)]
1235        pub fn removeGestureRecognizer(&self, gesture_recognizer: &UIGestureRecognizer);
1236
1237        #[cfg(feature = "UIGestureRecognizer")]
1238        #[unsafe(method(gestureRecognizerShouldBegin:))]
1239        #[unsafe(method_family = none)]
1240        pub fn gestureRecognizerShouldBegin(
1241            &self,
1242            gesture_recognizer: &UIGestureRecognizer,
1243        ) -> bool;
1244    );
1245}
1246
1247/// UIViewMotionEffects.
1248#[cfg(feature = "UIResponder")]
1249impl UIView {
1250    extern_methods!(
1251        #[cfg(feature = "UIMotionEffect")]
1252        /// Begins applying `effect` to the receiver. The effect's emitted keyPath/value pairs will be
1253        /// applied to the view's presentation layer.
1254        ///
1255        /// Animates the transition to the motion effect's values using the present UIView animation
1256        /// context.
1257        #[unsafe(method(addMotionEffect:))]
1258        #[unsafe(method_family = none)]
1259        pub fn addMotionEffect(&self, effect: &UIMotionEffect);
1260
1261        #[cfg(feature = "UIMotionEffect")]
1262        /// Stops applying `effect` to the receiver. Any affected presentation values will animate to
1263        /// their post-removal values using the present UIView animation context.
1264        #[unsafe(method(removeMotionEffect:))]
1265        #[unsafe(method_family = none)]
1266        pub fn removeMotionEffect(&self, effect: &UIMotionEffect);
1267
1268        #[cfg(feature = "UIMotionEffect")]
1269        #[unsafe(method(motionEffects))]
1270        #[unsafe(method_family = none)]
1271        pub fn motionEffects(&self) -> Retained<NSArray<UIMotionEffect>>;
1272
1273        #[cfg(feature = "UIMotionEffect")]
1274        /// Setter for [`motionEffects`][Self::motionEffects].
1275        ///
1276        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1277        #[unsafe(method(setMotionEffects:))]
1278        #[unsafe(method_family = none)]
1279        pub fn setMotionEffects(&self, motion_effects: &NSArray<UIMotionEffect>);
1280    );
1281}
1282
1283/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilayoutconstraintaxis?language=objc)
1284// NS_ENUM
1285#[repr(transparent)]
1286#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1287pub struct UILayoutConstraintAxis(pub NSInteger);
1288impl UILayoutConstraintAxis {
1289    #[doc(alias = "UILayoutConstraintAxisHorizontal")]
1290    pub const Horizontal: Self = Self(0);
1291    #[doc(alias = "UILayoutConstraintAxisVertical")]
1292    pub const Vertical: Self = Self(1);
1293}
1294
1295unsafe impl Encode for UILayoutConstraintAxis {
1296    const ENCODING: Encoding = NSInteger::ENCODING;
1297}
1298
1299unsafe impl RefEncode for UILayoutConstraintAxis {
1300    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1301}
1302
1303/// UIConstraintBasedLayoutInstallingConstraints.
1304#[cfg(feature = "UIResponder")]
1305impl UIView {
1306    extern_methods!(
1307        #[cfg(feature = "NSLayoutConstraint")]
1308        #[unsafe(method(constraints))]
1309        #[unsafe(method_family = none)]
1310        pub fn constraints(&self) -> Retained<NSArray<NSLayoutConstraint>>;
1311
1312        #[cfg(feature = "NSLayoutConstraint")]
1313        #[unsafe(method(addConstraint:))]
1314        #[unsafe(method_family = none)]
1315        pub fn addConstraint(&self, constraint: &NSLayoutConstraint);
1316
1317        #[cfg(feature = "NSLayoutConstraint")]
1318        #[unsafe(method(addConstraints:))]
1319        #[unsafe(method_family = none)]
1320        pub fn addConstraints(&self, constraints: &NSArray<NSLayoutConstraint>);
1321
1322        #[cfg(feature = "NSLayoutConstraint")]
1323        #[unsafe(method(removeConstraint:))]
1324        #[unsafe(method_family = none)]
1325        pub fn removeConstraint(&self, constraint: &NSLayoutConstraint);
1326
1327        #[cfg(feature = "NSLayoutConstraint")]
1328        #[unsafe(method(removeConstraints:))]
1329        #[unsafe(method_family = none)]
1330        pub fn removeConstraints(&self, constraints: &NSArray<NSLayoutConstraint>);
1331    );
1332}
1333
1334/// UIConstraintBasedLayoutCoreMethods.
1335#[cfg(feature = "UIResponder")]
1336impl UIView {
1337    extern_methods!(
1338        #[unsafe(method(updateConstraintsIfNeeded))]
1339        #[unsafe(method_family = none)]
1340        pub fn updateConstraintsIfNeeded(&self);
1341
1342        #[unsafe(method(updateConstraints))]
1343        #[unsafe(method_family = none)]
1344        pub fn updateConstraints(&self);
1345
1346        #[unsafe(method(needsUpdateConstraints))]
1347        #[unsafe(method_family = none)]
1348        pub fn needsUpdateConstraints(&self) -> bool;
1349
1350        #[unsafe(method(setNeedsUpdateConstraints))]
1351        #[unsafe(method_family = none)]
1352        pub fn setNeedsUpdateConstraints(&self);
1353    );
1354}
1355
1356/// UIConstraintBasedCompatibility.
1357#[cfg(feature = "UIResponder")]
1358impl UIView {
1359    extern_methods!(
1360        #[unsafe(method(translatesAutoresizingMaskIntoConstraints))]
1361        #[unsafe(method_family = none)]
1362        pub fn translatesAutoresizingMaskIntoConstraints(&self) -> bool;
1363
1364        /// Setter for [`translatesAutoresizingMaskIntoConstraints`][Self::translatesAutoresizingMaskIntoConstraints].
1365        #[unsafe(method(setTranslatesAutoresizingMaskIntoConstraints:))]
1366        #[unsafe(method_family = none)]
1367        pub fn setTranslatesAutoresizingMaskIntoConstraints(
1368            &self,
1369            translates_autoresizing_mask_into_constraints: bool,
1370        );
1371
1372        #[unsafe(method(requiresConstraintBasedLayout))]
1373        #[unsafe(method_family = none)]
1374        pub fn requiresConstraintBasedLayout(mtm: MainThreadMarker) -> bool;
1375    );
1376}
1377
1378extern "C" {
1379    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewnointrinsicmetric?language=objc)
1380    #[cfg(feature = "objc2-core-foundation")]
1381    pub static UIViewNoIntrinsicMetric: CGFloat;
1382}
1383
1384/// UIConstraintBasedLayoutLayering.
1385#[cfg(feature = "UIResponder")]
1386impl UIView {
1387    extern_methods!(
1388        #[cfg(feature = "objc2-core-foundation")]
1389        #[unsafe(method(alignmentRectForFrame:))]
1390        #[unsafe(method_family = none)]
1391        pub fn alignmentRectForFrame(&self, frame: CGRect) -> CGRect;
1392
1393        #[cfg(feature = "objc2-core-foundation")]
1394        #[unsafe(method(frameForAlignmentRect:))]
1395        #[unsafe(method_family = none)]
1396        pub fn frameForAlignmentRect(&self, alignment_rect: CGRect) -> CGRect;
1397
1398        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1399        #[unsafe(method(alignmentRectInsets))]
1400        #[unsafe(method_family = none)]
1401        pub fn alignmentRectInsets(&self) -> UIEdgeInsets;
1402
1403        #[deprecated = "Override -viewForFirstBaselineLayout or -viewForLastBaselineLayout as appropriate, instead"]
1404        #[unsafe(method(viewForBaselineLayout))]
1405        #[unsafe(method_family = none)]
1406        pub fn viewForBaselineLayout(&self) -> Retained<UIView>;
1407
1408        #[unsafe(method(viewForFirstBaselineLayout))]
1409        #[unsafe(method_family = none)]
1410        pub fn viewForFirstBaselineLayout(&self) -> Retained<UIView>;
1411
1412        #[unsafe(method(viewForLastBaselineLayout))]
1413        #[unsafe(method_family = none)]
1414        pub fn viewForLastBaselineLayout(&self) -> Retained<UIView>;
1415
1416        #[cfg(feature = "objc2-core-foundation")]
1417        #[unsafe(method(intrinsicContentSize))]
1418        #[unsafe(method_family = none)]
1419        pub fn intrinsicContentSize(&self) -> CGSize;
1420
1421        #[unsafe(method(invalidateIntrinsicContentSize))]
1422        #[unsafe(method_family = none)]
1423        pub fn invalidateIntrinsicContentSize(&self);
1424
1425        #[cfg(feature = "NSLayoutConstraint")]
1426        #[unsafe(method(contentHuggingPriorityForAxis:))]
1427        #[unsafe(method_family = none)]
1428        pub fn contentHuggingPriorityForAxis(
1429            &self,
1430            axis: UILayoutConstraintAxis,
1431        ) -> UILayoutPriority;
1432
1433        #[cfg(feature = "NSLayoutConstraint")]
1434        #[unsafe(method(setContentHuggingPriority:forAxis:))]
1435        #[unsafe(method_family = none)]
1436        pub fn setContentHuggingPriority_forAxis(
1437            &self,
1438            priority: UILayoutPriority,
1439            axis: UILayoutConstraintAxis,
1440        );
1441
1442        #[cfg(feature = "NSLayoutConstraint")]
1443        #[unsafe(method(contentCompressionResistancePriorityForAxis:))]
1444        #[unsafe(method_family = none)]
1445        pub fn contentCompressionResistancePriorityForAxis(
1446            &self,
1447            axis: UILayoutConstraintAxis,
1448        ) -> UILayoutPriority;
1449
1450        #[cfg(feature = "NSLayoutConstraint")]
1451        #[unsafe(method(setContentCompressionResistancePriority:forAxis:))]
1452        #[unsafe(method_family = none)]
1453        pub fn setContentCompressionResistancePriority_forAxis(
1454            &self,
1455            priority: UILayoutPriority,
1456            axis: UILayoutConstraintAxis,
1457        );
1458    );
1459}
1460
1461extern "C" {
1462    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilayoutfittingcompressedsize?language=objc)
1463    #[cfg(feature = "objc2-core-foundation")]
1464    pub static UILayoutFittingCompressedSize: CGSize;
1465}
1466
1467extern "C" {
1468    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilayoutfittingexpandedsize?language=objc)
1469    #[cfg(feature = "objc2-core-foundation")]
1470    pub static UILayoutFittingExpandedSize: CGSize;
1471}
1472
1473/// UIConstraintBasedLayoutFittingSize.
1474#[cfg(feature = "UIResponder")]
1475impl UIView {
1476    extern_methods!(
1477        #[cfg(feature = "objc2-core-foundation")]
1478        #[unsafe(method(systemLayoutSizeFittingSize:))]
1479        #[unsafe(method_family = none)]
1480        pub fn systemLayoutSizeFittingSize(&self, target_size: CGSize) -> CGSize;
1481
1482        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
1483        #[unsafe(method(systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:))]
1484        #[unsafe(method_family = none)]
1485        pub fn systemLayoutSizeFittingSize_withHorizontalFittingPriority_verticalFittingPriority(
1486            &self,
1487            target_size: CGSize,
1488            horizontal_fitting_priority: UILayoutPriority,
1489            vertical_fitting_priority: UILayoutPriority,
1490        ) -> CGSize;
1491    );
1492}
1493
1494/// UILayoutGuideSupport.
1495#[cfg(feature = "UIResponder")]
1496impl UIView {
1497    extern_methods!(
1498        #[cfg(feature = "UILayoutGuide")]
1499        #[unsafe(method(layoutGuides))]
1500        #[unsafe(method_family = none)]
1501        pub fn layoutGuides(&self) -> Retained<NSArray<UILayoutGuide>>;
1502
1503        #[cfg(feature = "UILayoutGuide")]
1504        #[unsafe(method(addLayoutGuide:))]
1505        #[unsafe(method_family = none)]
1506        pub fn addLayoutGuide(&self, layout_guide: &UILayoutGuide);
1507
1508        #[cfg(feature = "UILayoutGuide")]
1509        #[unsafe(method(removeLayoutGuide:))]
1510        #[unsafe(method_family = none)]
1511        pub fn removeLayoutGuide(&self, layout_guide: &UILayoutGuide);
1512    );
1513}
1514
1515/// UIViewLayoutConstraintCreation.
1516#[cfg(feature = "UIResponder")]
1517impl UIView {
1518    extern_methods!(
1519        #[cfg(feature = "NSLayoutAnchor")]
1520        #[unsafe(method(leadingAnchor))]
1521        #[unsafe(method_family = none)]
1522        pub fn leadingAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;
1523
1524        #[cfg(feature = "NSLayoutAnchor")]
1525        #[unsafe(method(trailingAnchor))]
1526        #[unsafe(method_family = none)]
1527        pub fn trailingAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;
1528
1529        #[cfg(feature = "NSLayoutAnchor")]
1530        #[unsafe(method(leftAnchor))]
1531        #[unsafe(method_family = none)]
1532        pub fn leftAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;
1533
1534        #[cfg(feature = "NSLayoutAnchor")]
1535        #[unsafe(method(rightAnchor))]
1536        #[unsafe(method_family = none)]
1537        pub fn rightAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;
1538
1539        #[cfg(feature = "NSLayoutAnchor")]
1540        #[unsafe(method(topAnchor))]
1541        #[unsafe(method_family = none)]
1542        pub fn topAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;
1543
1544        #[cfg(feature = "NSLayoutAnchor")]
1545        #[unsafe(method(bottomAnchor))]
1546        #[unsafe(method_family = none)]
1547        pub fn bottomAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;
1548
1549        #[cfg(feature = "NSLayoutAnchor")]
1550        #[unsafe(method(widthAnchor))]
1551        #[unsafe(method_family = none)]
1552        pub fn widthAnchor(&self) -> Retained<NSLayoutDimension>;
1553
1554        #[cfg(feature = "NSLayoutAnchor")]
1555        #[unsafe(method(heightAnchor))]
1556        #[unsafe(method_family = none)]
1557        pub fn heightAnchor(&self) -> Retained<NSLayoutDimension>;
1558
1559        #[cfg(feature = "NSLayoutAnchor")]
1560        #[unsafe(method(centerXAnchor))]
1561        #[unsafe(method_family = none)]
1562        pub fn centerXAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;
1563
1564        #[cfg(feature = "NSLayoutAnchor")]
1565        #[unsafe(method(centerYAnchor))]
1566        #[unsafe(method_family = none)]
1567        pub fn centerYAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;
1568
1569        #[cfg(feature = "NSLayoutAnchor")]
1570        #[unsafe(method(firstBaselineAnchor))]
1571        #[unsafe(method_family = none)]
1572        pub fn firstBaselineAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;
1573
1574        #[cfg(feature = "NSLayoutAnchor")]
1575        #[unsafe(method(lastBaselineAnchor))]
1576        #[unsafe(method_family = none)]
1577        pub fn lastBaselineAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;
1578    );
1579}
1580
1581/// UIConstraintBasedLayoutDebugging.
1582#[cfg(feature = "UIResponder")]
1583impl UIView {
1584    extern_methods!(
1585        #[cfg(feature = "NSLayoutConstraint")]
1586        #[unsafe(method(constraintsAffectingLayoutForAxis:))]
1587        #[unsafe(method_family = none)]
1588        pub fn constraintsAffectingLayoutForAxis(
1589            &self,
1590            axis: UILayoutConstraintAxis,
1591        ) -> Retained<NSArray<NSLayoutConstraint>>;
1592
1593        #[unsafe(method(hasAmbiguousLayout))]
1594        #[unsafe(method_family = none)]
1595        pub fn hasAmbiguousLayout(&self) -> bool;
1596
1597        #[unsafe(method(exerciseAmbiguityInLayout))]
1598        #[unsafe(method_family = none)]
1599        pub fn exerciseAmbiguityInLayout(&self);
1600    );
1601}
1602
1603/// UIConstraintBasedLayoutDebugging.
1604#[cfg(feature = "UILayoutGuide")]
1605impl UILayoutGuide {
1606    extern_methods!(
1607        #[cfg(feature = "NSLayoutConstraint")]
1608        #[unsafe(method(constraintsAffectingLayoutForAxis:))]
1609        #[unsafe(method_family = none)]
1610        pub fn constraintsAffectingLayoutForAxis(
1611            &self,
1612            axis: UILayoutConstraintAxis,
1613        ) -> Retained<NSArray<NSLayoutConstraint>>;
1614
1615        #[unsafe(method(hasAmbiguousLayout))]
1616        #[unsafe(method_family = none)]
1617        pub fn hasAmbiguousLayout(&self) -> bool;
1618    );
1619}
1620
1621/// UIStateRestoration.
1622#[cfg(feature = "UIResponder")]
1623impl UIView {
1624    extern_methods!(
1625        #[unsafe(method(restorationIdentifier))]
1626        #[unsafe(method_family = none)]
1627        pub fn restorationIdentifier(&self) -> Option<Retained<NSString>>;
1628
1629        /// Setter for [`restorationIdentifier`][Self::restorationIdentifier].
1630        ///
1631        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1632        #[unsafe(method(setRestorationIdentifier:))]
1633        #[unsafe(method_family = none)]
1634        pub fn setRestorationIdentifier(&self, restoration_identifier: Option<&NSString>);
1635
1636        /// # Safety
1637        ///
1638        /// `coder` possibly has further requirements.
1639        #[unsafe(method(encodeRestorableStateWithCoder:))]
1640        #[unsafe(method_family = none)]
1641        pub unsafe fn encodeRestorableStateWithCoder(&self, coder: &NSCoder);
1642
1643        /// # Safety
1644        ///
1645        /// `coder` possibly has further requirements.
1646        #[unsafe(method(decodeRestorableStateWithCoder:))]
1647        #[unsafe(method_family = none)]
1648        pub unsafe fn decodeRestorableStateWithCoder(&self, coder: &NSCoder);
1649    );
1650}
1651
1652/// UISnapshotting.
1653#[cfg(feature = "UIResponder")]
1654impl UIView {
1655    extern_methods!(
1656        #[unsafe(method(snapshotViewAfterScreenUpdates:))]
1657        #[unsafe(method_family = none)]
1658        pub fn snapshotViewAfterScreenUpdates(
1659            &self,
1660            after_updates: bool,
1661        ) -> Option<Retained<UIView>>;
1662
1663        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1664        #[unsafe(method(resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets:))]
1665        #[unsafe(method_family = none)]
1666        pub fn resizableSnapshotViewFromRect_afterScreenUpdates_withCapInsets(
1667            &self,
1668            rect: CGRect,
1669            after_updates: bool,
1670            cap_insets: UIEdgeInsets,
1671        ) -> Option<Retained<UIView>>;
1672
1673        #[cfg(feature = "objc2-core-foundation")]
1674        #[unsafe(method(drawViewHierarchyInRect:afterScreenUpdates:))]
1675        #[unsafe(method_family = none)]
1676        pub fn drawViewHierarchyInRect_afterScreenUpdates(
1677            &self,
1678            rect: CGRect,
1679            after_updates: bool,
1680        ) -> bool;
1681    );
1682}
1683
1684/// DeprecatedAnimations.
1685#[cfg(feature = "UIResponder")]
1686impl UIView {
1687    extern_methods!(
1688        /// # Safety
1689        ///
1690        /// `context` must be a valid pointer or null.
1691        #[deprecated = "Use the block-based animation API instead"]
1692        #[unsafe(method(beginAnimations:context:))]
1693        #[unsafe(method_family = none)]
1694        pub unsafe fn beginAnimations_context(
1695            animation_id: Option<&NSString>,
1696            context: *mut c_void,
1697            mtm: MainThreadMarker,
1698        );
1699
1700        #[deprecated = "Use the block-based animation API instead"]
1701        #[unsafe(method(commitAnimations))]
1702        #[unsafe(method_family = none)]
1703        pub fn commitAnimations(mtm: MainThreadMarker);
1704
1705        /// # Safety
1706        ///
1707        /// `delegate` should be of the correct type.
1708        #[deprecated = "Use the block-based animation API instead"]
1709        #[unsafe(method(setAnimationDelegate:))]
1710        #[unsafe(method_family = none)]
1711        pub unsafe fn setAnimationDelegate(delegate: Option<&AnyObject>, mtm: MainThreadMarker);
1712
1713        /// # Safety
1714        ///
1715        /// `selector` must be a valid selector.
1716        #[deprecated = "Use the block-based animation API instead"]
1717        #[unsafe(method(setAnimationWillStartSelector:))]
1718        #[unsafe(method_family = none)]
1719        pub unsafe fn setAnimationWillStartSelector(selector: Option<Sel>, mtm: MainThreadMarker);
1720
1721        /// # Safety
1722        ///
1723        /// `selector` must be a valid selector.
1724        #[deprecated = "Use the block-based animation API instead"]
1725        #[unsafe(method(setAnimationDidStopSelector:))]
1726        #[unsafe(method_family = none)]
1727        pub unsafe fn setAnimationDidStopSelector(selector: Option<Sel>, mtm: MainThreadMarker);
1728
1729        #[deprecated = "Use the block-based animation API instead"]
1730        #[unsafe(method(setAnimationDuration:))]
1731        #[unsafe(method_family = none)]
1732        pub fn setAnimationDuration(duration: NSTimeInterval, mtm: MainThreadMarker);
1733
1734        #[deprecated = "Use the block-based animation API instead"]
1735        #[unsafe(method(setAnimationDelay:))]
1736        #[unsafe(method_family = none)]
1737        pub fn setAnimationDelay(delay: NSTimeInterval, mtm: MainThreadMarker);
1738
1739        #[deprecated = "Use the block-based animation API instead"]
1740        #[unsafe(method(setAnimationStartDate:))]
1741        #[unsafe(method_family = none)]
1742        pub fn setAnimationStartDate(start_date: &NSDate, mtm: MainThreadMarker);
1743
1744        #[deprecated = "Use the block-based animation API instead"]
1745        #[unsafe(method(setAnimationCurve:))]
1746        #[unsafe(method_family = none)]
1747        pub fn setAnimationCurve(curve: UIViewAnimationCurve, mtm: MainThreadMarker);
1748
1749        #[deprecated = "Use the block-based animation API instead"]
1750        #[unsafe(method(setAnimationRepeatCount:))]
1751        #[unsafe(method_family = none)]
1752        pub fn setAnimationRepeatCount(repeat_count: c_float, mtm: MainThreadMarker);
1753
1754        #[deprecated = "Use the block-based animation API instead"]
1755        #[unsafe(method(setAnimationRepeatAutoreverses:))]
1756        #[unsafe(method_family = none)]
1757        pub fn setAnimationRepeatAutoreverses(repeat_autoreverses: bool, mtm: MainThreadMarker);
1758
1759        #[deprecated = "Use the block-based animation API instead"]
1760        #[unsafe(method(setAnimationBeginsFromCurrentState:))]
1761        #[unsafe(method_family = none)]
1762        pub fn setAnimationBeginsFromCurrentState(from_current_state: bool, mtm: MainThreadMarker);
1763
1764        #[deprecated = "Use the block-based animation API instead"]
1765        #[unsafe(method(setAnimationTransition:forView:cache:))]
1766        #[unsafe(method_family = none)]
1767        pub fn setAnimationTransition_forView_cache(
1768            transition: UIViewAnimationTransition,
1769            view: &UIView,
1770            cache: bool,
1771        );
1772    );
1773}
1774
1775/// UserInterfaceStyle.
1776#[cfg(feature = "UIResponder")]
1777impl UIView {
1778    extern_methods!(
1779        #[cfg(feature = "UIInterface")]
1780        #[unsafe(method(overrideUserInterfaceStyle))]
1781        #[unsafe(method_family = none)]
1782        pub fn overrideUserInterfaceStyle(&self) -> UIUserInterfaceStyle;
1783
1784        #[cfg(feature = "UIInterface")]
1785        /// Setter for [`overrideUserInterfaceStyle`][Self::overrideUserInterfaceStyle].
1786        #[unsafe(method(setOverrideUserInterfaceStyle:))]
1787        #[unsafe(method_family = none)]
1788        pub fn setOverrideUserInterfaceStyle(
1789            &self,
1790            override_user_interface_style: UIUserInterfaceStyle,
1791        );
1792    );
1793}
1794
1795/// UIContentSizeCategoryLimit.
1796#[cfg(feature = "UIResponder")]
1797impl UIView {
1798    extern_methods!(
1799        #[cfg(feature = "UIContentSizeCategory")]
1800        /// Specify content size category limits. Setting one or both of these properties will limit the
1801        /// content size category for this view (and its subviews) to a minimum or a maximum value.
1802        /// You can use this to limit the support content size categories on part of your view hierarchy.
1803        /// Setting this to nil removes the limit on the minimum or maximum.
1804        /// Limits will be applied immediately and when future content size category updates occur.
1805        ///
1806        /// Specifying a minimum limit that is greater than the maximum limit (or vice versa) will effectively
1807        /// only use the maximum limit.
1808        ///
1809        /// Example:
1810        ///
1811        /// // limit the support content size categories between .medium and .accessibilityExtraLarge (included).
1812        /// view.minimumContentSizeCategory = UIContentSizeCategoryMedium;
1813        /// view.maximumContentSizeCategory = UIContentSizeCategoryAccessibilityExtraLarge;
1814        #[unsafe(method(minimumContentSizeCategory))]
1815        #[unsafe(method_family = none)]
1816        pub fn minimumContentSizeCategory(&self) -> Option<Retained<UIContentSizeCategory>>;
1817
1818        #[cfg(feature = "UIContentSizeCategory")]
1819        /// Setter for [`minimumContentSizeCategory`][Self::minimumContentSizeCategory].
1820        ///
1821        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1822        #[unsafe(method(setMinimumContentSizeCategory:))]
1823        #[unsafe(method_family = none)]
1824        pub fn setMinimumContentSizeCategory(
1825            &self,
1826            minimum_content_size_category: Option<&UIContentSizeCategory>,
1827        );
1828
1829        #[cfg(feature = "UIContentSizeCategory")]
1830        #[unsafe(method(maximumContentSizeCategory))]
1831        #[unsafe(method_family = none)]
1832        pub fn maximumContentSizeCategory(&self) -> Option<Retained<UIContentSizeCategory>>;
1833
1834        #[cfg(feature = "UIContentSizeCategory")]
1835        /// Setter for [`maximumContentSizeCategory`][Self::maximumContentSizeCategory].
1836        ///
1837        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1838        #[unsafe(method(setMaximumContentSizeCategory:))]
1839        #[unsafe(method_family = none)]
1840        pub fn setMaximumContentSizeCategory(
1841            &self,
1842            maximum_content_size_category: Option<&UIContentSizeCategory>,
1843        );
1844
1845        /// Will return a string with a log of all the superviews of this view, alongside with what
1846        /// content size category each view has and if that view has limits applied.
1847        /// This is for debugging purposes only.
1848        #[unsafe(method(appliedContentSizeCategoryLimitsDescription))]
1849        #[unsafe(method_family = none)]
1850        pub fn appliedContentSizeCategoryLimitsDescription(&self) -> Retained<NSString>;
1851    );
1852}
1853
1854#[cfg(feature = "UIResponder")]
1855impl UIView {
1856    extern_methods!(
1857        #[cfg(feature = "UITraitCollection")]
1858        #[unsafe(method(traitOverrides))]
1859        #[unsafe(method_family = none)]
1860        pub fn traitOverrides(&self) -> Retained<ProtocolObject<dyn UITraitOverrides>>;
1861
1862        /// Forces an immediate trait update for this view (and its view controller, if applicable) and any subviews,
1863        /// including any view controllers or views in its subtree. Any trait change callbacks are sent synchronously.
1864        #[unsafe(method(updateTraitsIfNeeded))]
1865        #[unsafe(method_family = none)]
1866        pub fn updateTraitsIfNeeded(&self);
1867    );
1868}
1869
1870#[cfg(all(feature = "UIResponder", feature = "UITraitCollection"))]
1871extern_conformance!(
1872    unsafe impl UITraitChangeObservable for UIView {}
1873);
1874
1875/// LayoutRegions.
1876#[cfg(feature = "UIResponder")]
1877impl UIView {
1878    extern_methods!(
1879        #[cfg(all(feature = "UILayoutGuide", feature = "UIViewLayoutRegion"))]
1880        #[unsafe(method(layoutGuideForLayoutRegion:))]
1881        #[unsafe(method_family = none)]
1882        pub fn layoutGuideForLayoutRegion(
1883            &self,
1884            layout_region: &UIViewLayoutRegion,
1885        ) -> Retained<UILayoutGuide>;
1886
1887        #[cfg(all(
1888            feature = "UIGeometry",
1889            feature = "UIViewLayoutRegion",
1890            feature = "objc2-core-foundation"
1891        ))]
1892        #[unsafe(method(edgeInsetsForLayoutRegion:))]
1893        #[unsafe(method_family = none)]
1894        pub fn edgeInsetsForLayoutRegion(&self, layout_region: &UIViewLayoutRegion)
1895            -> UIEdgeInsets;
1896
1897        #[cfg(all(
1898            feature = "UIGeometry",
1899            feature = "UIViewLayoutRegion",
1900            feature = "objc2-core-foundation"
1901        ))]
1902        #[unsafe(method(directionalEdgeInsetsForLayoutRegion:))]
1903        #[unsafe(method_family = none)]
1904        pub fn directionalEdgeInsetsForLayoutRegion(
1905            &self,
1906            layout_region: &UIViewLayoutRegion,
1907        ) -> NSDirectionalEdgeInsets;
1908    );
1909}
1910
1911/// CornerConfiguration.
1912#[cfg(feature = "UIResponder")]
1913impl UIView {
1914    extern_methods!(
1915        #[cfg(feature = "UICornerConfiguration")]
1916        /// A configuration that defines the corners of the view.
1917        #[unsafe(method(cornerConfiguration))]
1918        #[unsafe(method_family = none)]
1919        pub fn cornerConfiguration(&self) -> Retained<UICornerConfiguration>;
1920
1921        #[cfg(feature = "UICornerConfiguration")]
1922        /// Setter for [`cornerConfiguration`][Self::cornerConfiguration].
1923        ///
1924        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1925        #[unsafe(method(setCornerConfiguration:))]
1926        #[unsafe(method_family = none)]
1927        pub fn setCornerConfiguration(&self, corner_configuration: &UICornerConfiguration);
1928
1929        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
1930        /// Returns the effective radius for the given `corner`, calculated using the view's current `cornerConfiguration`.
1931        ///
1932        /// When invoked within ``UIView.layoutSubviews()``, ``UIView.updateProperties()``, or ``UIViewController.updateProperties()`` automatic invalidation will occur if the effective radius changes.
1933        /// If more than one `corner` is provided, the returned radius represents the maximum effective radius of those corners.
1934        ///
1935        /// - Parameter corner: The corner.
1936        /// - Returns: The effective radius.
1937        #[unsafe(method(effectiveRadiusForCorner:))]
1938        #[unsafe(method_family = none)]
1939        pub fn effectiveRadiusForCorner(&self, corner: UIRectCorner) -> CGFloat;
1940    );
1941}