objc2-ui-kit 0.3.2

Bindings to the UIKit framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewanimationcurve?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewAnimationCurve(pub NSInteger);
impl UIViewAnimationCurve {
    #[doc(alias = "UIViewAnimationCurveEaseInOut")]
    pub const EaseInOut: Self = Self(0);
    #[doc(alias = "UIViewAnimationCurveEaseIn")]
    pub const EaseIn: Self = Self(1);
    #[doc(alias = "UIViewAnimationCurveEaseOut")]
    pub const EaseOut: Self = Self(2);
    #[doc(alias = "UIViewAnimationCurveLinear")]
    pub const Linear: Self = Self(3);
}

unsafe impl Encode for UIViewAnimationCurve {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIViewAnimationCurve {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewcontentmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewContentMode(pub NSInteger);
impl UIViewContentMode {
    #[doc(alias = "UIViewContentModeScaleToFill")]
    pub const ScaleToFill: Self = Self(0);
    #[doc(alias = "UIViewContentModeScaleAspectFit")]
    pub const ScaleAspectFit: Self = Self(1);
    #[doc(alias = "UIViewContentModeScaleAspectFill")]
    pub const ScaleAspectFill: Self = Self(2);
    #[doc(alias = "UIViewContentModeRedraw")]
    pub const Redraw: Self = Self(3);
    #[doc(alias = "UIViewContentModeCenter")]
    pub const Center: Self = Self(4);
    #[doc(alias = "UIViewContentModeTop")]
    pub const Top: Self = Self(5);
    #[doc(alias = "UIViewContentModeBottom")]
    pub const Bottom: Self = Self(6);
    #[doc(alias = "UIViewContentModeLeft")]
    pub const Left: Self = Self(7);
    #[doc(alias = "UIViewContentModeRight")]
    pub const Right: Self = Self(8);
    #[doc(alias = "UIViewContentModeTopLeft")]
    pub const TopLeft: Self = Self(9);
    #[doc(alias = "UIViewContentModeTopRight")]
    pub const TopRight: Self = Self(10);
    #[doc(alias = "UIViewContentModeBottomLeft")]
    pub const BottomLeft: Self = Self(11);
    #[doc(alias = "UIViewContentModeBottomRight")]
    pub const BottomRight: Self = Self(12);
}

unsafe impl Encode for UIViewContentMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIViewContentMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewanimationtransition?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewAnimationTransition(pub NSInteger);
impl UIViewAnimationTransition {
    #[doc(alias = "UIViewAnimationTransitionNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UIViewAnimationTransitionFlipFromLeft")]
    pub const FlipFromLeft: Self = Self(1);
    #[doc(alias = "UIViewAnimationTransitionFlipFromRight")]
    pub const FlipFromRight: Self = Self(2);
    #[doc(alias = "UIViewAnimationTransitionCurlUp")]
    pub const CurlUp: Self = Self(3);
    #[doc(alias = "UIViewAnimationTransitionCurlDown")]
    pub const CurlDown: Self = Self(4);
}

unsafe impl Encode for UIViewAnimationTransition {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIViewAnimationTransition {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewautoresizing?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewAutoresizing(pub NSUInteger);
bitflags::bitflags! {
    impl UIViewAutoresizing: NSUInteger {
        #[doc(alias = "UIViewAutoresizingNone")]
        const None = 0;
        #[doc(alias = "UIViewAutoresizingFlexibleLeftMargin")]
        const FlexibleLeftMargin = 1<<0;
        #[doc(alias = "UIViewAutoresizingFlexibleWidth")]
        const FlexibleWidth = 1<<1;
        #[doc(alias = "UIViewAutoresizingFlexibleRightMargin")]
        const FlexibleRightMargin = 1<<2;
        #[doc(alias = "UIViewAutoresizingFlexibleTopMargin")]
        const FlexibleTopMargin = 1<<3;
        #[doc(alias = "UIViewAutoresizingFlexibleHeight")]
        const FlexibleHeight = 1<<4;
        #[doc(alias = "UIViewAutoresizingFlexibleBottomMargin")]
        const FlexibleBottomMargin = 1<<5;
    }
}

unsafe impl Encode for UIViewAutoresizing {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for UIViewAutoresizing {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewanimationoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewAnimationOptions(pub NSUInteger);
bitflags::bitflags! {
    impl UIViewAnimationOptions: NSUInteger {
        #[doc(alias = "UIViewAnimationOptionLayoutSubviews")]
        const LayoutSubviews = 1<<0;
        #[doc(alias = "UIViewAnimationOptionAllowUserInteraction")]
        const AllowUserInteraction = 1<<1;
        #[doc(alias = "UIViewAnimationOptionBeginFromCurrentState")]
        const BeginFromCurrentState = 1<<2;
        #[doc(alias = "UIViewAnimationOptionRepeat")]
        const Repeat = 1<<3;
        #[doc(alias = "UIViewAnimationOptionAutoreverse")]
        const Autoreverse = 1<<4;
        #[doc(alias = "UIViewAnimationOptionOverrideInheritedDuration")]
        const OverrideInheritedDuration = 1<<5;
        #[doc(alias = "UIViewAnimationOptionOverrideInheritedCurve")]
        const OverrideInheritedCurve = 1<<6;
        #[doc(alias = "UIViewAnimationOptionAllowAnimatedContent")]
        const AllowAnimatedContent = 1<<7;
        #[doc(alias = "UIViewAnimationOptionShowHideTransitionViews")]
        const ShowHideTransitionViews = 1<<8;
        #[doc(alias = "UIViewAnimationOptionOverrideInheritedOptions")]
        const OverrideInheritedOptions = 1<<9;
        #[doc(alias = "UIViewAnimationOptionCurveEaseInOut")]
        const CurveEaseInOut = 0<<16;
        #[doc(alias = "UIViewAnimationOptionCurveEaseIn")]
        const CurveEaseIn = 1<<16;
        #[doc(alias = "UIViewAnimationOptionCurveEaseOut")]
        const CurveEaseOut = 2<<16;
        #[doc(alias = "UIViewAnimationOptionCurveLinear")]
        const CurveLinear = 3<<16;
        #[doc(alias = "UIViewAnimationOptionTransitionNone")]
        const TransitionNone = 0<<20;
        #[doc(alias = "UIViewAnimationOptionTransitionFlipFromLeft")]
        const TransitionFlipFromLeft = 1<<20;
        #[doc(alias = "UIViewAnimationOptionTransitionFlipFromRight")]
        const TransitionFlipFromRight = 2<<20;
        #[doc(alias = "UIViewAnimationOptionTransitionCurlUp")]
        const TransitionCurlUp = 3<<20;
        #[doc(alias = "UIViewAnimationOptionTransitionCurlDown")]
        const TransitionCurlDown = 4<<20;
        #[doc(alias = "UIViewAnimationOptionTransitionCrossDissolve")]
        const TransitionCrossDissolve = 5<<20;
        #[doc(alias = "UIViewAnimationOptionTransitionFlipFromTop")]
        const TransitionFlipFromTop = 6<<20;
        #[doc(alias = "UIViewAnimationOptionTransitionFlipFromBottom")]
        const TransitionFlipFromBottom = 7<<20;
        #[doc(alias = "UIViewAnimationOptionPreferredFramesPerSecondDefault")]
        const PreferredFramesPerSecondDefault = 0<<24;
        #[doc(alias = "UIViewAnimationOptionPreferredFramesPerSecond60")]
        const PreferredFramesPerSecond60 = 3<<24;
        #[doc(alias = "UIViewAnimationOptionPreferredFramesPerSecond30")]
        const PreferredFramesPerSecond30 = 7<<24;
/// Flush all pending updates (including traits, properties, and layout) whenever the animation context changes.
/// This includes flushing updates:
/// - Before entering an animation scope, for invalidations that happened previously without animation.
/// - Before entering a nested animation scope, for invalidations that happened in the outer animation scope.
/// - Before exiting any animation scope, for invalidations that happened in that animation scope.
/// - Before disabling animations, for invalidations that happened in the animation scope with animations enabled.
/// - Before re-enabling animations, for invalidations that happened in the scope with animations disabled.
/// This animation option implicitly applies to any nested animation scopes, even if they don't explicitly use this option.
        #[doc(alias = "UIViewAnimationOptionFlushUpdates")]
        const FlushUpdates = 1<<28;
    }
}

unsafe impl Encode for UIViewAnimationOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for UIViewAnimationOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewkeyframeanimationoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewKeyframeAnimationOptions(pub NSUInteger);
bitflags::bitflags! {
    impl UIViewKeyframeAnimationOptions: NSUInteger {
        #[doc(alias = "UIViewKeyframeAnimationOptionLayoutSubviews")]
        const LayoutSubviews = UIViewAnimationOptions::LayoutSubviews.0;
        #[doc(alias = "UIViewKeyframeAnimationOptionAllowUserInteraction")]
        const AllowUserInteraction = UIViewAnimationOptions::AllowUserInteraction.0;
        #[doc(alias = "UIViewKeyframeAnimationOptionBeginFromCurrentState")]
        const BeginFromCurrentState = UIViewAnimationOptions::BeginFromCurrentState.0;
        #[doc(alias = "UIViewKeyframeAnimationOptionRepeat")]
        const Repeat = UIViewAnimationOptions::Repeat.0;
        #[doc(alias = "UIViewKeyframeAnimationOptionAutoreverse")]
        const Autoreverse = UIViewAnimationOptions::Autoreverse.0;
        #[doc(alias = "UIViewKeyframeAnimationOptionOverrideInheritedDuration")]
        const OverrideInheritedDuration = UIViewAnimationOptions::OverrideInheritedDuration.0;
        #[doc(alias = "UIViewKeyframeAnimationOptionOverrideInheritedOptions")]
        const OverrideInheritedOptions = UIViewAnimationOptions::OverrideInheritedOptions.0;
        #[doc(alias = "UIViewKeyframeAnimationOptionCalculationModeLinear")]
        const CalculationModeLinear = 0<<10;
        #[doc(alias = "UIViewKeyframeAnimationOptionCalculationModeDiscrete")]
        const CalculationModeDiscrete = 1<<10;
        #[doc(alias = "UIViewKeyframeAnimationOptionCalculationModePaced")]
        const CalculationModePaced = 2<<10;
        #[doc(alias = "UIViewKeyframeAnimationOptionCalculationModeCubic")]
        const CalculationModeCubic = 3<<10;
        #[doc(alias = "UIViewKeyframeAnimationOptionCalculationModeCubicPaced")]
        const CalculationModeCubicPaced = 4<<10;
    }
}

unsafe impl Encode for UIViewKeyframeAnimationOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for UIViewKeyframeAnimationOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisystemanimation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UISystemAnimation(pub NSUInteger);
impl UISystemAnimation {
    #[doc(alias = "UISystemAnimationDelete")]
    pub const Delete: Self = Self(0);
}

unsafe impl Encode for UISystemAnimation {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for UISystemAnimation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewtintadjustmentmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewTintAdjustmentMode(pub NSInteger);
impl UIViewTintAdjustmentMode {
    #[doc(alias = "UIViewTintAdjustmentModeAutomatic")]
    pub const Automatic: Self = Self(0);
    #[doc(alias = "UIViewTintAdjustmentModeNormal")]
    pub const Normal: Self = Self(1);
    #[doc(alias = "UIViewTintAdjustmentModeDimmed")]
    pub const Dimmed: Self = Self(2);
}

unsafe impl Encode for UIViewTintAdjustmentMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIViewTintAdjustmentMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisemanticcontentattribute?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UISemanticContentAttribute(pub NSInteger);
impl UISemanticContentAttribute {
    #[doc(alias = "UISemanticContentAttributeUnspecified")]
    pub const Unspecified: Self = Self(0);
    #[doc(alias = "UISemanticContentAttributePlayback")]
    pub const Playback: Self = Self(1);
    #[doc(alias = "UISemanticContentAttributeSpatial")]
    pub const Spatial: Self = Self(2);
    #[doc(alias = "UISemanticContentAttributeForceLeftToRight")]
    pub const ForceLeftToRight: Self = Self(3);
    #[doc(alias = "UISemanticContentAttributeForceRightToLeft")]
    pub const ForceRightToLeft: Self = Self(4);
}

unsafe impl Encode for UISemanticContentAttribute {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UISemanticContentAttribute {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiview?language=objc)
    #[unsafe(super(UIResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "UIResponder")]
    pub struct UIView;
);

#[cfg(all(feature = "UIResponder", feature = "objc2-quartz-core"))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
    unsafe impl CALayerDelegate for UIView {}
);

#[cfg(feature = "UIResponder")]
extern_conformance!(
    unsafe impl NSCoding for UIView {}
);

#[cfg(feature = "UIResponder")]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIView {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder"))]
extern_conformance!(
    unsafe impl UIAppearance for UIView {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder"))]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UIView {}
);

#[cfg(feature = "UIResponder")]
extern_conformance!(
    unsafe impl UICoordinateSpace for UIView {}
);

#[cfg(all(feature = "UIDynamicBehavior", feature = "UIResponder"))]
extern_conformance!(
    unsafe impl UIDynamicItem for UIView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder"))]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UIView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder"))]
extern_conformance!(
    unsafe impl UIFocusItem for UIView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder"))]
extern_conformance!(
    unsafe impl UIFocusItemContainer for UIView {}
);

#[cfg(feature = "UIResponder")]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for UIView {}
);

#[cfg(all(feature = "UIResponder", feature = "UITraitCollection"))]
extern_conformance!(
    unsafe impl UITraitEnvironment for UIView {}
);

#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[unsafe(method(layerClass))]
        #[unsafe(method_family = none)]
        pub fn layerClass(mtm: MainThreadMarker) -> &'static AnyClass;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(isUserInteractionEnabled))]
        #[unsafe(method_family = none)]
        pub fn isUserInteractionEnabled(&self) -> bool;

        /// Setter for [`isUserInteractionEnabled`][Self::isUserInteractionEnabled].
        #[unsafe(method(setUserInteractionEnabled:))]
        #[unsafe(method_family = none)]
        pub fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);

        #[unsafe(method(tag))]
        #[unsafe(method_family = none)]
        pub fn tag(&self) -> NSInteger;

        /// Setter for [`tag`][Self::tag].
        #[unsafe(method(setTag:))]
        #[unsafe(method_family = none)]
        pub fn setTag(&self, tag: NSInteger);

        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(not(target_os = "watchos"))]
        #[unsafe(method(layer))]
        #[unsafe(method_family = none)]
        pub fn layer(&self) -> Retained<CALayer>;

        #[unsafe(method(canBecomeFocused))]
        #[unsafe(method_family = none)]
        pub fn canBecomeFocused(&self) -> bool;

        #[unsafe(method(isFocused))]
        #[unsafe(method_family = none)]
        pub fn isFocused(&self) -> bool;

        /// The identifier of the focus group that this view belongs to. If this is nil, subviews inherit their superview's focus group.
        #[unsafe(method(focusGroupIdentifier))]
        #[unsafe(method_family = none)]
        pub fn focusGroupIdentifier(&self) -> Option<Retained<NSString>>;

        /// Setter for [`focusGroupIdentifier`][Self::focusGroupIdentifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setFocusGroupIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn setFocusGroupIdentifier(&self, focus_group_identifier: Option<&NSString>);

        #[cfg(feature = "UIFocus")]
        /// 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.
        /// 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).
        #[unsafe(method(focusGroupPriority))]
        #[unsafe(method_family = none)]
        pub fn focusGroupPriority(&self) -> UIFocusGroupPriority;

        #[cfg(feature = "UIFocus")]
        /// Setter for [`focusGroupPriority`][Self::focusGroupPriority].
        #[unsafe(method(setFocusGroupPriority:))]
        #[unsafe(method_family = none)]
        pub fn setFocusGroupPriority(&self, focus_group_priority: UIFocusGroupPriority);

        #[cfg(feature = "UIFocusEffect")]
        /// 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.
        #[unsafe(method(focusEffect))]
        #[unsafe(method_family = none)]
        pub fn focusEffect(&self) -> Option<Retained<UIFocusEffect>>;

        #[cfg(feature = "UIFocusEffect")]
        /// Setter for [`focusEffect`][Self::focusEffect].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setFocusEffect:))]
        #[unsafe(method_family = none)]
        pub fn setFocusEffect(&self, focus_effect: Option<&UIFocusEffect>);

        #[unsafe(method(semanticContentAttribute))]
        #[unsafe(method_family = none)]
        pub fn semanticContentAttribute(&self) -> UISemanticContentAttribute;

        /// Setter for [`semanticContentAttribute`][Self::semanticContentAttribute].
        #[unsafe(method(setSemanticContentAttribute:))]
        #[unsafe(method_family = none)]
        pub fn setSemanticContentAttribute(
            &self,
            semantic_content_attribute: UISemanticContentAttribute,
        );

        #[cfg(feature = "UIInterface")]
        #[unsafe(method(userInterfaceLayoutDirectionForSemanticContentAttribute:))]
        #[unsafe(method_family = none)]
        pub fn userInterfaceLayoutDirectionForSemanticContentAttribute(
            attribute: UISemanticContentAttribute,
            mtm: MainThreadMarker,
        ) -> UIUserInterfaceLayoutDirection;

        #[cfg(feature = "UIInterface")]
        #[unsafe(method(userInterfaceLayoutDirectionForSemanticContentAttribute:relativeToLayoutDirection:))]
        #[unsafe(method_family = none)]
        pub fn userInterfaceLayoutDirectionForSemanticContentAttribute_relativeToLayoutDirection(
            semantic_content_attribute: UISemanticContentAttribute,
            layout_direction: UIUserInterfaceLayoutDirection,
            mtm: MainThreadMarker,
        ) -> UIUserInterfaceLayoutDirection;

        #[cfg(feature = "UIInterface")]
        #[unsafe(method(effectiveUserInterfaceLayoutDirection))]
        #[unsafe(method_family = none)]
        pub fn effectiveUserInterfaceLayoutDirection(&self) -> UIUserInterfaceLayoutDirection;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

/// UIViewGeometry.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(frame))]
        #[unsafe(method_family = none)]
        pub fn frame(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`frame`][Self::frame].
        #[unsafe(method(setFrame:))]
        #[unsafe(method_family = none)]
        pub fn setFrame(&self, frame: CGRect);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(bounds))]
        #[unsafe(method_family = none)]
        pub fn bounds(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`bounds`][Self::bounds].
        #[unsafe(method(setBounds:))]
        #[unsafe(method_family = none)]
        pub fn setBounds(&self, bounds: CGRect);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(center))]
        #[unsafe(method_family = none)]
        pub fn center(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`center`][Self::center].
        #[unsafe(method(setCenter:))]
        #[unsafe(method_family = none)]
        pub fn setCenter(&self, center: CGPoint);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(transform))]
        #[unsafe(method_family = none)]
        pub fn transform(&self) -> CGAffineTransform;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`transform`][Self::transform].
        #[unsafe(method(setTransform:))]
        #[unsafe(method_family = none)]
        pub fn setTransform(&self, transform: CGAffineTransform);

        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(not(target_os = "watchos"))]
        #[unsafe(method(transform3D))]
        #[unsafe(method_family = none)]
        pub fn transform3D(&self) -> CATransform3D;

        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(not(target_os = "watchos"))]
        /// Setter for [`transform3D`][Self::transform3D].
        #[unsafe(method(setTransform3D:))]
        #[unsafe(method_family = none)]
        pub fn setTransform3D(&self, transform3_d: CATransform3D);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(contentScaleFactor))]
        #[unsafe(method_family = none)]
        pub fn contentScaleFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`contentScaleFactor`][Self::contentScaleFactor].
        #[unsafe(method(setContentScaleFactor:))]
        #[unsafe(method_family = none)]
        pub fn setContentScaleFactor(&self, content_scale_factor: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(anchorPoint))]
        #[unsafe(method_family = none)]
        pub fn anchorPoint(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`anchorPoint`][Self::anchorPoint].
        #[unsafe(method(setAnchorPoint:))]
        #[unsafe(method_family = none)]
        pub fn setAnchorPoint(&self, anchor_point: CGPoint);

        #[unsafe(method(isMultipleTouchEnabled))]
        #[unsafe(method_family = none)]
        pub fn isMultipleTouchEnabled(&self) -> bool;

        /// Setter for [`isMultipleTouchEnabled`][Self::isMultipleTouchEnabled].
        #[unsafe(method(setMultipleTouchEnabled:))]
        #[unsafe(method_family = none)]
        pub fn setMultipleTouchEnabled(&self, multiple_touch_enabled: bool);

        #[unsafe(method(isExclusiveTouch))]
        #[unsafe(method_family = none)]
        pub fn isExclusiveTouch(&self) -> bool;

        /// Setter for [`isExclusiveTouch`][Self::isExclusiveTouch].
        #[unsafe(method(setExclusiveTouch:))]
        #[unsafe(method_family = none)]
        pub fn setExclusiveTouch(&self, exclusive_touch: bool);

        #[cfg(all(feature = "UIEvent", feature = "objc2-core-foundation"))]
        #[unsafe(method(hitTest:withEvent:))]
        #[unsafe(method_family = none)]
        pub fn hitTest_withEvent(
            &self,
            point: CGPoint,
            event: Option<&UIEvent>,
        ) -> Option<Retained<UIView>>;

        #[cfg(all(feature = "UIEvent", feature = "objc2-core-foundation"))]
        #[unsafe(method(pointInside:withEvent:))]
        #[unsafe(method_family = none)]
        pub fn pointInside_withEvent(&self, point: CGPoint, event: Option<&UIEvent>) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(convertPoint:toView:))]
        #[unsafe(method_family = none)]
        pub fn convertPoint_toView(&self, point: CGPoint, view: Option<&UIView>) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(convertPoint:fromView:))]
        #[unsafe(method_family = none)]
        pub fn convertPoint_fromView(&self, point: CGPoint, view: Option<&UIView>) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(convertRect:toView:))]
        #[unsafe(method_family = none)]
        pub fn convertRect_toView(&self, rect: CGRect, view: Option<&UIView>) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(convertRect:fromView:))]
        #[unsafe(method_family = none)]
        pub fn convertRect_fromView(&self, rect: CGRect, view: Option<&UIView>) -> CGRect;

        #[unsafe(method(autoresizesSubviews))]
        #[unsafe(method_family = none)]
        pub fn autoresizesSubviews(&self) -> bool;

        /// Setter for [`autoresizesSubviews`][Self::autoresizesSubviews].
        #[unsafe(method(setAutoresizesSubviews:))]
        #[unsafe(method_family = none)]
        pub fn setAutoresizesSubviews(&self, autoresizes_subviews: bool);

        #[unsafe(method(autoresizingMask))]
        #[unsafe(method_family = none)]
        pub fn autoresizingMask(&self) -> UIViewAutoresizing;

        /// Setter for [`autoresizingMask`][Self::autoresizingMask].
        #[unsafe(method(setAutoresizingMask:))]
        #[unsafe(method_family = none)]
        pub fn setAutoresizingMask(&self, autoresizing_mask: UIViewAutoresizing);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(sizeThatFits:))]
        #[unsafe(method_family = none)]
        pub fn sizeThatFits(&self, size: CGSize) -> CGSize;

        #[unsafe(method(sizeToFit))]
        #[unsafe(method_family = none)]
        pub fn sizeToFit(&self);
    );
}

/// UIViewHierarchy.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[unsafe(method(superview))]
        #[unsafe(method_family = none)]
        pub fn superview(&self) -> Option<Retained<UIView>>;

        #[unsafe(method(subviews))]
        #[unsafe(method_family = none)]
        pub fn subviews(&self) -> Retained<NSArray<UIView>>;

        #[cfg(feature = "UIWindow")]
        #[unsafe(method(window))]
        #[unsafe(method_family = none)]
        pub fn window(&self) -> Option<Retained<UIWindow>>;

        #[unsafe(method(removeFromSuperview))]
        #[unsafe(method_family = none)]
        pub fn removeFromSuperview(&self);

        #[unsafe(method(insertSubview:atIndex:))]
        #[unsafe(method_family = none)]
        pub fn insertSubview_atIndex(&self, view: &UIView, index: NSInteger);

        #[unsafe(method(exchangeSubviewAtIndex:withSubviewAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn exchangeSubviewAtIndex_withSubviewAtIndex(
            &self,
            index1: NSInteger,
            index2: NSInteger,
        );

        #[unsafe(method(addSubview:))]
        #[unsafe(method_family = none)]
        pub fn addSubview(&self, view: &UIView);

        #[unsafe(method(insertSubview:belowSubview:))]
        #[unsafe(method_family = none)]
        pub fn insertSubview_belowSubview(&self, view: &UIView, sibling_subview: &UIView);

        #[unsafe(method(insertSubview:aboveSubview:))]
        #[unsafe(method_family = none)]
        pub fn insertSubview_aboveSubview(&self, view: &UIView, sibling_subview: &UIView);

        #[unsafe(method(bringSubviewToFront:))]
        #[unsafe(method_family = none)]
        pub fn bringSubviewToFront(&self, view: &UIView);

        #[unsafe(method(sendSubviewToBack:))]
        #[unsafe(method_family = none)]
        pub fn sendSubviewToBack(&self, view: &UIView);

        #[unsafe(method(didAddSubview:))]
        #[unsafe(method_family = none)]
        pub fn didAddSubview(&self, subview: &UIView);

        #[unsafe(method(willRemoveSubview:))]
        #[unsafe(method_family = none)]
        pub fn willRemoveSubview(&self, subview: &UIView);

        #[unsafe(method(willMoveToSuperview:))]
        #[unsafe(method_family = none)]
        pub fn willMoveToSuperview(&self, new_superview: Option<&UIView>);

        #[unsafe(method(didMoveToSuperview))]
        #[unsafe(method_family = none)]
        pub fn didMoveToSuperview(&self);

        #[cfg(feature = "UIWindow")]
        #[unsafe(method(willMoveToWindow:))]
        #[unsafe(method_family = none)]
        pub fn willMoveToWindow(&self, new_window: Option<&UIWindow>);

        #[unsafe(method(didMoveToWindow))]
        #[unsafe(method_family = none)]
        pub fn didMoveToWindow(&self);

        #[unsafe(method(isDescendantOfView:))]
        #[unsafe(method_family = none)]
        pub fn isDescendantOfView(&self, view: &UIView) -> bool;

        #[unsafe(method(viewWithTag:))]
        #[unsafe(method_family = none)]
        pub fn viewWithTag(&self, tag: NSInteger) -> Option<Retained<UIView>>;

        /// Call to manually request a properties update for the view.
        /// Multiple requests may be coalesced into a single update alongside the next layout pass.
        #[unsafe(method(setNeedsUpdateProperties))]
        #[unsafe(method_family = none)]
        pub fn setNeedsUpdateProperties(&self);

        /// Override point for subclasses to update properties of this view.
        /// Never call this method directly; use `setNeedsUpdateProperties` to schedule an update.
        #[unsafe(method(updateProperties))]
        #[unsafe(method_family = none)]
        pub fn updateProperties(&self);

        /// Forces an immediate properties update for this view (and its view controller, if applicable)
        /// and any subviews, including any view controllers or views in its subtree.
        #[unsafe(method(updatePropertiesIfNeeded))]
        #[unsafe(method_family = none)]
        pub fn updatePropertiesIfNeeded(&self);

        #[unsafe(method(setNeedsLayout))]
        #[unsafe(method_family = none)]
        pub fn setNeedsLayout(&self);

        #[unsafe(method(layoutIfNeeded))]
        #[unsafe(method_family = none)]
        pub fn layoutIfNeeded(&self);

        #[unsafe(method(layoutSubviews))]
        #[unsafe(method_family = none)]
        pub fn layoutSubviews(&self);

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(layoutMargins))]
        #[unsafe(method_family = none)]
        pub fn layoutMargins(&self) -> UIEdgeInsets;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Setter for [`layoutMargins`][Self::layoutMargins].
        #[unsafe(method(setLayoutMargins:))]
        #[unsafe(method_family = none)]
        pub fn setLayoutMargins(&self, layout_margins: UIEdgeInsets);

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(directionalLayoutMargins))]
        #[unsafe(method_family = none)]
        pub fn directionalLayoutMargins(&self) -> NSDirectionalEdgeInsets;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Setter for [`directionalLayoutMargins`][Self::directionalLayoutMargins].
        #[unsafe(method(setDirectionalLayoutMargins:))]
        #[unsafe(method_family = none)]
        pub fn setDirectionalLayoutMargins(
            &self,
            directional_layout_margins: NSDirectionalEdgeInsets,
        );

        #[unsafe(method(preservesSuperviewLayoutMargins))]
        #[unsafe(method_family = none)]
        pub fn preservesSuperviewLayoutMargins(&self) -> bool;

        /// Setter for [`preservesSuperviewLayoutMargins`][Self::preservesSuperviewLayoutMargins].
        #[unsafe(method(setPreservesSuperviewLayoutMargins:))]
        #[unsafe(method_family = none)]
        pub fn setPreservesSuperviewLayoutMargins(&self, preserves_superview_layout_margins: bool);

        #[unsafe(method(insetsLayoutMarginsFromSafeArea))]
        #[unsafe(method_family = none)]
        pub fn insetsLayoutMarginsFromSafeArea(&self) -> bool;

        /// Setter for [`insetsLayoutMarginsFromSafeArea`][Self::insetsLayoutMarginsFromSafeArea].
        #[unsafe(method(setInsetsLayoutMarginsFromSafeArea:))]
        #[unsafe(method_family = none)]
        pub fn setInsetsLayoutMarginsFromSafeArea(
            &self,
            insets_layout_margins_from_safe_area: bool,
        );

        #[unsafe(method(layoutMarginsDidChange))]
        #[unsafe(method_family = none)]
        pub fn layoutMarginsDidChange(&self);

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(safeAreaInsets))]
        #[unsafe(method_family = none)]
        pub fn safeAreaInsets(&self) -> UIEdgeInsets;

        #[unsafe(method(safeAreaInsetsDidChange))]
        #[unsafe(method_family = none)]
        pub fn safeAreaInsetsDidChange(&self);

        #[cfg(feature = "UILayoutGuide")]
        #[unsafe(method(layoutMarginsGuide))]
        #[unsafe(method_family = none)]
        pub fn layoutMarginsGuide(&self) -> Retained<UILayoutGuide>;

        #[cfg(feature = "UILayoutGuide")]
        /// 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.
        #[unsafe(method(readableContentGuide))]
        #[unsafe(method_family = none)]
        pub fn readableContentGuide(&self) -> Retained<UILayoutGuide>;

        #[cfg(feature = "UILayoutGuide")]
        #[unsafe(method(safeAreaLayoutGuide))]
        #[unsafe(method_family = none)]
        pub fn safeAreaLayoutGuide(&self) -> Retained<UILayoutGuide>;

        #[cfg(all(
            feature = "UIKeyboardLayoutGuide",
            feature = "UILayoutGuide",
            feature = "UITrackingLayoutGuide"
        ))]
        /// Follows the keyboard when on screen and docked. See UIKeyboardLayoutGuide.h for additional options.
        #[unsafe(method(keyboardLayoutGuide))]
        #[unsafe(method_family = none)]
        pub fn keyboardLayoutGuide(&self) -> Retained<UIKeyboardLayoutGuide>;
    );
}

/// UIViewRendering.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawRect:))]
        #[unsafe(method_family = none)]
        pub fn drawRect(&self, rect: CGRect);

        #[unsafe(method(setNeedsDisplay))]
        #[unsafe(method_family = none)]
        pub fn setNeedsDisplay(&self);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(setNeedsDisplayInRect:))]
        #[unsafe(method_family = none)]
        pub fn setNeedsDisplayInRect(&self, rect: CGRect);

        #[unsafe(method(clipsToBounds))]
        #[unsafe(method_family = none)]
        pub fn clipsToBounds(&self) -> bool;

        /// Setter for [`clipsToBounds`][Self::clipsToBounds].
        #[unsafe(method(setClipsToBounds:))]
        #[unsafe(method_family = none)]
        pub fn setClipsToBounds(&self, clips_to_bounds: bool);

        #[cfg(feature = "UIColor")]
        #[unsafe(method(backgroundColor))]
        #[unsafe(method_family = none)]
        pub fn backgroundColor(&self) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UIColor")]
        /// Setter for [`backgroundColor`][Self::backgroundColor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBackgroundColor:))]
        #[unsafe(method_family = none)]
        pub fn setBackgroundColor(&self, background_color: Option<&UIColor>);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(alpha))]
        #[unsafe(method_family = none)]
        pub fn alpha(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`alpha`][Self::alpha].
        #[unsafe(method(setAlpha:))]
        #[unsafe(method_family = none)]
        pub fn setAlpha(&self, alpha: CGFloat);

        #[unsafe(method(isOpaque))]
        #[unsafe(method_family = none)]
        pub fn isOpaque(&self) -> bool;

        /// Setter for [`isOpaque`][Self::isOpaque].
        #[unsafe(method(setOpaque:))]
        #[unsafe(method_family = none)]
        pub fn setOpaque(&self, opaque: bool);

        #[unsafe(method(clearsContextBeforeDrawing))]
        #[unsafe(method_family = none)]
        pub fn clearsContextBeforeDrawing(&self) -> bool;

        /// Setter for [`clearsContextBeforeDrawing`][Self::clearsContextBeforeDrawing].
        #[unsafe(method(setClearsContextBeforeDrawing:))]
        #[unsafe(method_family = none)]
        pub fn setClearsContextBeforeDrawing(&self, clears_context_before_drawing: bool);

        #[unsafe(method(isHidden))]
        #[unsafe(method_family = none)]
        pub fn isHidden(&self) -> bool;

        /// Setter for [`isHidden`][Self::isHidden].
        #[unsafe(method(setHidden:))]
        #[unsafe(method_family = none)]
        pub fn setHidden(&self, hidden: bool);

        #[unsafe(method(contentMode))]
        #[unsafe(method_family = none)]
        pub fn contentMode(&self) -> UIViewContentMode;

        /// Setter for [`contentMode`][Self::contentMode].
        #[unsafe(method(setContentMode:))]
        #[unsafe(method_family = none)]
        pub fn setContentMode(&self, content_mode: UIViewContentMode);

        #[cfg(feature = "objc2-core-foundation")]
        #[deprecated]
        #[unsafe(method(contentStretch))]
        #[unsafe(method_family = none)]
        pub fn contentStretch(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`contentStretch`][Self::contentStretch].
        #[deprecated]
        #[unsafe(method(setContentStretch:))]
        #[unsafe(method_family = none)]
        pub fn setContentStretch(&self, content_stretch: CGRect);

        #[unsafe(method(maskView))]
        #[unsafe(method_family = none)]
        pub fn maskView(&self) -> Option<Retained<UIView>>;

        /// Setter for [`maskView`][Self::maskView].
        #[unsafe(method(setMaskView:))]
        #[unsafe(method_family = none)]
        pub fn setMaskView(&self, mask_view: Option<&UIView>);

        #[cfg(feature = "UIColor")]
        #[unsafe(method(tintColor))]
        #[unsafe(method_family = none)]
        pub fn tintColor(&self) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UIColor")]
        /// Setter for [`tintColor`][Self::tintColor].
        ///
        /// # Safety
        ///
        /// `tint_color` might not allow `None`.
        #[unsafe(method(setTintColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);

        #[unsafe(method(tintAdjustmentMode))]
        #[unsafe(method_family = none)]
        pub fn tintAdjustmentMode(&self) -> UIViewTintAdjustmentMode;

        /// Setter for [`tintAdjustmentMode`][Self::tintAdjustmentMode].
        #[unsafe(method(setTintAdjustmentMode:))]
        #[unsafe(method_family = none)]
        pub fn setTintAdjustmentMode(&self, tint_adjustment_mode: UIViewTintAdjustmentMode);

        #[unsafe(method(tintColorDidChange))]
        #[unsafe(method_family = none)]
        pub fn tintColorDidChange(&self);
    );
}

/// UIViewAnimation.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[unsafe(method(setAnimationsEnabled:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationsEnabled(enabled: bool, mtm: MainThreadMarker);

        #[unsafe(method(areAnimationsEnabled))]
        #[unsafe(method_family = none)]
        pub fn areAnimationsEnabled(mtm: MainThreadMarker) -> bool;

        #[cfg(feature = "block2")]
        #[unsafe(method(performWithoutAnimation:))]
        #[unsafe(method_family = none)]
        pub fn performWithoutAnimation(
            actions_without_animation: &block2::DynBlock<dyn Fn() + '_>,
            mtm: MainThreadMarker,
        );

        #[unsafe(method(inheritedAnimationDuration))]
        #[unsafe(method_family = none)]
        pub fn inheritedAnimationDuration(mtm: MainThreadMarker) -> NSTimeInterval;
    );
}

/// UIViewAnimationWithBlocks.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "block2")]
        #[unsafe(method(animateWithDuration:delay:options:animations:completion:))]
        #[unsafe(method_family = none)]
        pub fn animateWithDuration_delay_options_animations_completion(
            duration: NSTimeInterval,
            delay: NSTimeInterval,
            options: UIViewAnimationOptions,
            animations: &block2::DynBlock<dyn Fn()>,
            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
            mtm: MainThreadMarker,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(animateWithDuration:animations:completion:))]
        #[unsafe(method_family = none)]
        pub fn animateWithDuration_animations_completion(
            duration: NSTimeInterval,
            animations: &block2::DynBlock<dyn Fn()>,
            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
            mtm: MainThreadMarker,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(animateWithDuration:animations:))]
        #[unsafe(method_family = none)]
        pub fn animateWithDuration_animations(
            duration: NSTimeInterval,
            animations: &block2::DynBlock<dyn Fn()>,
            mtm: MainThreadMarker,
        );

        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
        #[unsafe(method(animateWithSpringDuration:bounce:initialSpringVelocity:delay:options:animations:completion:))]
        #[unsafe(method_family = none)]
        pub fn animateWithSpringDuration_bounce_initialSpringVelocity_delay_options_animations_completion(
            duration: NSTimeInterval,
            bounce: CGFloat,
            velocity: CGFloat,
            delay: NSTimeInterval,
            options: UIViewAnimationOptions,
            animations: &block2::DynBlock<dyn Fn() + '_>,
            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
            mtm: MainThreadMarker,
        );

        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
        #[unsafe(method(animateWithDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:))]
        #[unsafe(method_family = none)]
        pub fn animateWithDuration_delay_usingSpringWithDamping_initialSpringVelocity_options_animations_completion(
            duration: NSTimeInterval,
            delay: NSTimeInterval,
            damping_ratio: CGFloat,
            velocity: CGFloat,
            options: UIViewAnimationOptions,
            animations: &block2::DynBlock<dyn Fn()>,
            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
            mtm: MainThreadMarker,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(transitionWithView:duration:options:animations:completion:))]
        #[unsafe(method_family = none)]
        pub fn transitionWithView_duration_options_animations_completion(
            view: &UIView,
            duration: NSTimeInterval,
            options: UIViewAnimationOptions,
            animations: Option<&block2::DynBlock<dyn Fn()>>,
            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(transitionFromView:toView:duration:options:completion:))]
        #[unsafe(method_family = none)]
        pub fn transitionFromView_toView_duration_options_completion(
            from_view: &UIView,
            to_view: &UIView,
            duration: NSTimeInterval,
            options: UIViewAnimationOptions,
            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(performSystemAnimation:onViews:options:animations:completion:))]
        #[unsafe(method_family = none)]
        pub fn performSystemAnimation_onViews_options_animations_completion(
            animation: UISystemAnimation,
            views: &NSArray<UIView>,
            options: UIViewAnimationOptions,
            parallel_animations: Option<&block2::DynBlock<dyn Fn()>>,
            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
            mtm: MainThreadMarker,
        );

        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
        #[unsafe(method(modifyAnimationsWithRepeatCount:autoreverses:animations:))]
        #[unsafe(method_family = none)]
        pub fn modifyAnimationsWithRepeatCount_autoreverses_animations(
            count: CGFloat,
            autoreverses: bool,
            animations: &block2::DynBlock<dyn Fn() + '_>,
            mtm: MainThreadMarker,
        );
    );
}

/// UIViewKeyframeAnimations.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "block2")]
        #[unsafe(method(animateKeyframesWithDuration:delay:options:animations:completion:))]
        #[unsafe(method_family = none)]
        pub fn animateKeyframesWithDuration_delay_options_animations_completion(
            duration: NSTimeInterval,
            delay: NSTimeInterval,
            options: UIViewKeyframeAnimationOptions,
            animations: &block2::DynBlock<dyn Fn()>,
            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
            mtm: MainThreadMarker,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(addKeyframeWithRelativeStartTime:relativeDuration:animations:))]
        #[unsafe(method_family = none)]
        pub fn addKeyframeWithRelativeStartTime_relativeDuration_animations(
            frame_start_time: c_double,
            frame_duration: c_double,
            animations: &block2::DynBlock<dyn Fn()>,
            mtm: MainThreadMarker,
        );
    );
}

/// UIViewGestureRecognizers.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "UIGestureRecognizer")]
        #[unsafe(method(gestureRecognizers))]
        #[unsafe(method_family = none)]
        pub fn gestureRecognizers(&self) -> Option<Retained<NSArray<UIGestureRecognizer>>>;

        #[cfg(feature = "UIGestureRecognizer")]
        /// Setter for [`gestureRecognizers`][Self::gestureRecognizers].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setGestureRecognizers:))]
        #[unsafe(method_family = none)]
        pub fn setGestureRecognizers(
            &self,
            gesture_recognizers: Option<&NSArray<UIGestureRecognizer>>,
        );

        #[cfg(feature = "UIGestureRecognizer")]
        #[unsafe(method(addGestureRecognizer:))]
        #[unsafe(method_family = none)]
        pub fn addGestureRecognizer(&self, gesture_recognizer: &UIGestureRecognizer);

        #[cfg(feature = "UIGestureRecognizer")]
        #[unsafe(method(removeGestureRecognizer:))]
        #[unsafe(method_family = none)]
        pub fn removeGestureRecognizer(&self, gesture_recognizer: &UIGestureRecognizer);

        #[cfg(feature = "UIGestureRecognizer")]
        #[unsafe(method(gestureRecognizerShouldBegin:))]
        #[unsafe(method_family = none)]
        pub fn gestureRecognizerShouldBegin(
            &self,
            gesture_recognizer: &UIGestureRecognizer,
        ) -> bool;
    );
}

/// UIViewMotionEffects.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "UIMotionEffect")]
        /// Begins applying `effect` to the receiver. The effect's emitted keyPath/value pairs will be
        /// applied to the view's presentation layer.
        ///
        /// Animates the transition to the motion effect's values using the present UIView animation
        /// context.
        #[unsafe(method(addMotionEffect:))]
        #[unsafe(method_family = none)]
        pub fn addMotionEffect(&self, effect: &UIMotionEffect);

        #[cfg(feature = "UIMotionEffect")]
        /// Stops applying `effect` to the receiver. Any affected presentation values will animate to
        /// their post-removal values using the present UIView animation context.
        #[unsafe(method(removeMotionEffect:))]
        #[unsafe(method_family = none)]
        pub fn removeMotionEffect(&self, effect: &UIMotionEffect);

        #[cfg(feature = "UIMotionEffect")]
        #[unsafe(method(motionEffects))]
        #[unsafe(method_family = none)]
        pub fn motionEffects(&self) -> Retained<NSArray<UIMotionEffect>>;

        #[cfg(feature = "UIMotionEffect")]
        /// Setter for [`motionEffects`][Self::motionEffects].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setMotionEffects:))]
        #[unsafe(method_family = none)]
        pub fn setMotionEffects(&self, motion_effects: &NSArray<UIMotionEffect>);
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilayoutconstraintaxis?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UILayoutConstraintAxis(pub NSInteger);
impl UILayoutConstraintAxis {
    #[doc(alias = "UILayoutConstraintAxisHorizontal")]
    pub const Horizontal: Self = Self(0);
    #[doc(alias = "UILayoutConstraintAxisVertical")]
    pub const Vertical: Self = Self(1);
}

unsafe impl Encode for UILayoutConstraintAxis {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UILayoutConstraintAxis {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// UIConstraintBasedLayoutInstallingConstraints.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(constraints))]
        #[unsafe(method_family = none)]
        pub fn constraints(&self) -> Retained<NSArray<NSLayoutConstraint>>;

        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(addConstraint:))]
        #[unsafe(method_family = none)]
        pub fn addConstraint(&self, constraint: &NSLayoutConstraint);

        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(addConstraints:))]
        #[unsafe(method_family = none)]
        pub fn addConstraints(&self, constraints: &NSArray<NSLayoutConstraint>);

        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(removeConstraint:))]
        #[unsafe(method_family = none)]
        pub fn removeConstraint(&self, constraint: &NSLayoutConstraint);

        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(removeConstraints:))]
        #[unsafe(method_family = none)]
        pub fn removeConstraints(&self, constraints: &NSArray<NSLayoutConstraint>);
    );
}

/// UIConstraintBasedLayoutCoreMethods.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[unsafe(method(updateConstraintsIfNeeded))]
        #[unsafe(method_family = none)]
        pub fn updateConstraintsIfNeeded(&self);

        #[unsafe(method(updateConstraints))]
        #[unsafe(method_family = none)]
        pub fn updateConstraints(&self);

        #[unsafe(method(needsUpdateConstraints))]
        #[unsafe(method_family = none)]
        pub fn needsUpdateConstraints(&self) -> bool;

        #[unsafe(method(setNeedsUpdateConstraints))]
        #[unsafe(method_family = none)]
        pub fn setNeedsUpdateConstraints(&self);
    );
}

/// UIConstraintBasedCompatibility.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[unsafe(method(translatesAutoresizingMaskIntoConstraints))]
        #[unsafe(method_family = none)]
        pub fn translatesAutoresizingMaskIntoConstraints(&self) -> bool;

        /// Setter for [`translatesAutoresizingMaskIntoConstraints`][Self::translatesAutoresizingMaskIntoConstraints].
        #[unsafe(method(setTranslatesAutoresizingMaskIntoConstraints:))]
        #[unsafe(method_family = none)]
        pub fn setTranslatesAutoresizingMaskIntoConstraints(
            &self,
            translates_autoresizing_mask_into_constraints: bool,
        );

        #[unsafe(method(requiresConstraintBasedLayout))]
        #[unsafe(method_family = none)]
        pub fn requiresConstraintBasedLayout(mtm: MainThreadMarker) -> bool;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewnointrinsicmetric?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static UIViewNoIntrinsicMetric: CGFloat;
}

/// UIConstraintBasedLayoutLayering.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(alignmentRectForFrame:))]
        #[unsafe(method_family = none)]
        pub fn alignmentRectForFrame(&self, frame: CGRect) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(frameForAlignmentRect:))]
        #[unsafe(method_family = none)]
        pub fn frameForAlignmentRect(&self, alignment_rect: CGRect) -> CGRect;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(alignmentRectInsets))]
        #[unsafe(method_family = none)]
        pub fn alignmentRectInsets(&self) -> UIEdgeInsets;

        #[deprecated = "Override -viewForFirstBaselineLayout or -viewForLastBaselineLayout as appropriate, instead"]
        #[unsafe(method(viewForBaselineLayout))]
        #[unsafe(method_family = none)]
        pub fn viewForBaselineLayout(&self) -> Retained<UIView>;

        #[unsafe(method(viewForFirstBaselineLayout))]
        #[unsafe(method_family = none)]
        pub fn viewForFirstBaselineLayout(&self) -> Retained<UIView>;

        #[unsafe(method(viewForLastBaselineLayout))]
        #[unsafe(method_family = none)]
        pub fn viewForLastBaselineLayout(&self) -> Retained<UIView>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(intrinsicContentSize))]
        #[unsafe(method_family = none)]
        pub fn intrinsicContentSize(&self) -> CGSize;

        #[unsafe(method(invalidateIntrinsicContentSize))]
        #[unsafe(method_family = none)]
        pub fn invalidateIntrinsicContentSize(&self);

        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(contentHuggingPriorityForAxis:))]
        #[unsafe(method_family = none)]
        pub fn contentHuggingPriorityForAxis(
            &self,
            axis: UILayoutConstraintAxis,
        ) -> UILayoutPriority;

        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(setContentHuggingPriority:forAxis:))]
        #[unsafe(method_family = none)]
        pub fn setContentHuggingPriority_forAxis(
            &self,
            priority: UILayoutPriority,
            axis: UILayoutConstraintAxis,
        );

        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(contentCompressionResistancePriorityForAxis:))]
        #[unsafe(method_family = none)]
        pub fn contentCompressionResistancePriorityForAxis(
            &self,
            axis: UILayoutConstraintAxis,
        ) -> UILayoutPriority;

        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(setContentCompressionResistancePriority:forAxis:))]
        #[unsafe(method_family = none)]
        pub fn setContentCompressionResistancePriority_forAxis(
            &self,
            priority: UILayoutPriority,
            axis: UILayoutConstraintAxis,
        );
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilayoutfittingcompressedsize?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static UILayoutFittingCompressedSize: CGSize;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilayoutfittingexpandedsize?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static UILayoutFittingExpandedSize: CGSize;
}

/// UIConstraintBasedLayoutFittingSize.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(systemLayoutSizeFittingSize:))]
        #[unsafe(method_family = none)]
        pub fn systemLayoutSizeFittingSize(&self, target_size: CGSize) -> CGSize;

        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
        #[unsafe(method(systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:))]
        #[unsafe(method_family = none)]
        pub fn systemLayoutSizeFittingSize_withHorizontalFittingPriority_verticalFittingPriority(
            &self,
            target_size: CGSize,
            horizontal_fitting_priority: UILayoutPriority,
            vertical_fitting_priority: UILayoutPriority,
        ) -> CGSize;
    );
}

/// UILayoutGuideSupport.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "UILayoutGuide")]
        #[unsafe(method(layoutGuides))]
        #[unsafe(method_family = none)]
        pub fn layoutGuides(&self) -> Retained<NSArray<UILayoutGuide>>;

        #[cfg(feature = "UILayoutGuide")]
        #[unsafe(method(addLayoutGuide:))]
        #[unsafe(method_family = none)]
        pub fn addLayoutGuide(&self, layout_guide: &UILayoutGuide);

        #[cfg(feature = "UILayoutGuide")]
        #[unsafe(method(removeLayoutGuide:))]
        #[unsafe(method_family = none)]
        pub fn removeLayoutGuide(&self, layout_guide: &UILayoutGuide);
    );
}

/// UIViewLayoutConstraintCreation.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(leadingAnchor))]
        #[unsafe(method_family = none)]
        pub fn leadingAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(trailingAnchor))]
        #[unsafe(method_family = none)]
        pub fn trailingAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(leftAnchor))]
        #[unsafe(method_family = none)]
        pub fn leftAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(rightAnchor))]
        #[unsafe(method_family = none)]
        pub fn rightAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(topAnchor))]
        #[unsafe(method_family = none)]
        pub fn topAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(bottomAnchor))]
        #[unsafe(method_family = none)]
        pub fn bottomAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(widthAnchor))]
        #[unsafe(method_family = none)]
        pub fn widthAnchor(&self) -> Retained<NSLayoutDimension>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(heightAnchor))]
        #[unsafe(method_family = none)]
        pub fn heightAnchor(&self) -> Retained<NSLayoutDimension>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(centerXAnchor))]
        #[unsafe(method_family = none)]
        pub fn centerXAnchor(&self) -> Retained<NSLayoutXAxisAnchor>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(centerYAnchor))]
        #[unsafe(method_family = none)]
        pub fn centerYAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(firstBaselineAnchor))]
        #[unsafe(method_family = none)]
        pub fn firstBaselineAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;

        #[cfg(feature = "NSLayoutAnchor")]
        #[unsafe(method(lastBaselineAnchor))]
        #[unsafe(method_family = none)]
        pub fn lastBaselineAnchor(&self) -> Retained<NSLayoutYAxisAnchor>;
    );
}

/// UIConstraintBasedLayoutDebugging.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(constraintsAffectingLayoutForAxis:))]
        #[unsafe(method_family = none)]
        pub fn constraintsAffectingLayoutForAxis(
            &self,
            axis: UILayoutConstraintAxis,
        ) -> Retained<NSArray<NSLayoutConstraint>>;

        #[unsafe(method(hasAmbiguousLayout))]
        #[unsafe(method_family = none)]
        pub fn hasAmbiguousLayout(&self) -> bool;

        #[unsafe(method(exerciseAmbiguityInLayout))]
        #[unsafe(method_family = none)]
        pub fn exerciseAmbiguityInLayout(&self);
    );
}

/// UIConstraintBasedLayoutDebugging.
#[cfg(feature = "UILayoutGuide")]
impl UILayoutGuide {
    extern_methods!(
        #[cfg(feature = "NSLayoutConstraint")]
        #[unsafe(method(constraintsAffectingLayoutForAxis:))]
        #[unsafe(method_family = none)]
        pub fn constraintsAffectingLayoutForAxis(
            &self,
            axis: UILayoutConstraintAxis,
        ) -> Retained<NSArray<NSLayoutConstraint>>;

        #[unsafe(method(hasAmbiguousLayout))]
        #[unsafe(method_family = none)]
        pub fn hasAmbiguousLayout(&self) -> bool;
    );
}

/// UIStateRestoration.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[unsafe(method(restorationIdentifier))]
        #[unsafe(method_family = none)]
        pub fn restorationIdentifier(&self) -> Option<Retained<NSString>>;

        /// Setter for [`restorationIdentifier`][Self::restorationIdentifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setRestorationIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn setRestorationIdentifier(&self, restoration_identifier: Option<&NSString>);

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(encodeRestorableStateWithCoder:))]
        #[unsafe(method_family = none)]
        pub unsafe fn encodeRestorableStateWithCoder(&self, coder: &NSCoder);

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(decodeRestorableStateWithCoder:))]
        #[unsafe(method_family = none)]
        pub unsafe fn decodeRestorableStateWithCoder(&self, coder: &NSCoder);
    );
}

/// UISnapshotting.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[unsafe(method(snapshotViewAfterScreenUpdates:))]
        #[unsafe(method_family = none)]
        pub fn snapshotViewAfterScreenUpdates(
            &self,
            after_updates: bool,
        ) -> Option<Retained<UIView>>;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets:))]
        #[unsafe(method_family = none)]
        pub fn resizableSnapshotViewFromRect_afterScreenUpdates_withCapInsets(
            &self,
            rect: CGRect,
            after_updates: bool,
            cap_insets: UIEdgeInsets,
        ) -> Option<Retained<UIView>>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawViewHierarchyInRect:afterScreenUpdates:))]
        #[unsafe(method_family = none)]
        pub fn drawViewHierarchyInRect_afterScreenUpdates(
            &self,
            rect: CGRect,
            after_updates: bool,
        ) -> bool;
    );
}

/// DeprecatedAnimations.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        /// # Safety
        ///
        /// `context` must be a valid pointer or null.
        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(beginAnimations:context:))]
        #[unsafe(method_family = none)]
        pub unsafe fn beginAnimations_context(
            animation_id: Option<&NSString>,
            context: *mut c_void,
            mtm: MainThreadMarker,
        );

        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(commitAnimations))]
        #[unsafe(method_family = none)]
        pub fn commitAnimations(mtm: MainThreadMarker);

        /// # Safety
        ///
        /// `delegate` should be of the correct type.
        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAnimationDelegate(delegate: Option<&AnyObject>, mtm: MainThreadMarker);

        /// # Safety
        ///
        /// `selector` must be a valid selector.
        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationWillStartSelector:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAnimationWillStartSelector(selector: Option<Sel>, mtm: MainThreadMarker);

        /// # Safety
        ///
        /// `selector` must be a valid selector.
        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationDidStopSelector:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAnimationDidStopSelector(selector: Option<Sel>, mtm: MainThreadMarker);

        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationDuration:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationDuration(duration: NSTimeInterval, mtm: MainThreadMarker);

        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationDelay:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationDelay(delay: NSTimeInterval, mtm: MainThreadMarker);

        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationStartDate:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationStartDate(start_date: &NSDate, mtm: MainThreadMarker);

        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationCurve:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationCurve(curve: UIViewAnimationCurve, mtm: MainThreadMarker);

        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationRepeatCount:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationRepeatCount(repeat_count: c_float, mtm: MainThreadMarker);

        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationRepeatAutoreverses:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationRepeatAutoreverses(repeat_autoreverses: bool, mtm: MainThreadMarker);

        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationBeginsFromCurrentState:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationBeginsFromCurrentState(from_current_state: bool, mtm: MainThreadMarker);

        #[deprecated = "Use the block-based animation API instead"]
        #[unsafe(method(setAnimationTransition:forView:cache:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationTransition_forView_cache(
            transition: UIViewAnimationTransition,
            view: &UIView,
            cache: bool,
        );
    );
}

/// UserInterfaceStyle.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "UIInterface")]
        #[unsafe(method(overrideUserInterfaceStyle))]
        #[unsafe(method_family = none)]
        pub fn overrideUserInterfaceStyle(&self) -> UIUserInterfaceStyle;

        #[cfg(feature = "UIInterface")]
        /// Setter for [`overrideUserInterfaceStyle`][Self::overrideUserInterfaceStyle].
        #[unsafe(method(setOverrideUserInterfaceStyle:))]
        #[unsafe(method_family = none)]
        pub fn setOverrideUserInterfaceStyle(
            &self,
            override_user_interface_style: UIUserInterfaceStyle,
        );
    );
}

/// UIContentSizeCategoryLimit.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "UIContentSizeCategory")]
        /// Specify content size category limits. Setting one or both of these properties will limit the
        /// content size category for this view (and its subviews) to a minimum or a maximum value.
        /// You can use this to limit the support content size categories on part of your view hierarchy.
        /// Setting this to nil removes the limit on the minimum or maximum.
        /// Limits will be applied immediately and when future content size category updates occur.
        ///
        /// Specifying a minimum limit that is greater than the maximum limit (or vice versa) will effectively
        /// only use the maximum limit.
        ///
        /// Example:
        ///
        /// // limit the support content size categories between .medium and .accessibilityExtraLarge (included).
        /// view.minimumContentSizeCategory = UIContentSizeCategoryMedium;
        /// view.maximumContentSizeCategory = UIContentSizeCategoryAccessibilityExtraLarge;
        #[unsafe(method(minimumContentSizeCategory))]
        #[unsafe(method_family = none)]
        pub fn minimumContentSizeCategory(&self) -> Option<Retained<UIContentSizeCategory>>;

        #[cfg(feature = "UIContentSizeCategory")]
        /// Setter for [`minimumContentSizeCategory`][Self::minimumContentSizeCategory].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setMinimumContentSizeCategory:))]
        #[unsafe(method_family = none)]
        pub fn setMinimumContentSizeCategory(
            &self,
            minimum_content_size_category: Option<&UIContentSizeCategory>,
        );

        #[cfg(feature = "UIContentSizeCategory")]
        #[unsafe(method(maximumContentSizeCategory))]
        #[unsafe(method_family = none)]
        pub fn maximumContentSizeCategory(&self) -> Option<Retained<UIContentSizeCategory>>;

        #[cfg(feature = "UIContentSizeCategory")]
        /// Setter for [`maximumContentSizeCategory`][Self::maximumContentSizeCategory].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setMaximumContentSizeCategory:))]
        #[unsafe(method_family = none)]
        pub fn setMaximumContentSizeCategory(
            &self,
            maximum_content_size_category: Option<&UIContentSizeCategory>,
        );

        /// Will return a string with a log of all the superviews of this view, alongside with what
        /// content size category each view has and if that view has limits applied.
        /// This is for debugging purposes only.
        #[unsafe(method(appliedContentSizeCategoryLimitsDescription))]
        #[unsafe(method_family = none)]
        pub fn appliedContentSizeCategoryLimitsDescription(&self) -> Retained<NSString>;
    );
}

#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "UITraitCollection")]
        #[unsafe(method(traitOverrides))]
        #[unsafe(method_family = none)]
        pub fn traitOverrides(&self) -> Retained<ProtocolObject<dyn UITraitOverrides>>;

        /// Forces an immediate trait update for this view (and its view controller, if applicable) and any subviews,
        /// including any view controllers or views in its subtree. Any trait change callbacks are sent synchronously.
        #[unsafe(method(updateTraitsIfNeeded))]
        #[unsafe(method_family = none)]
        pub fn updateTraitsIfNeeded(&self);
    );
}

#[cfg(all(feature = "UIResponder", feature = "UITraitCollection"))]
extern_conformance!(
    unsafe impl UITraitChangeObservable for UIView {}
);

/// LayoutRegions.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(all(feature = "UILayoutGuide", feature = "UIViewLayoutRegion"))]
        #[unsafe(method(layoutGuideForLayoutRegion:))]
        #[unsafe(method_family = none)]
        pub fn layoutGuideForLayoutRegion(
            &self,
            layout_region: &UIViewLayoutRegion,
        ) -> Retained<UILayoutGuide>;

        #[cfg(all(
            feature = "UIGeometry",
            feature = "UIViewLayoutRegion",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(edgeInsetsForLayoutRegion:))]
        #[unsafe(method_family = none)]
        pub fn edgeInsetsForLayoutRegion(&self, layout_region: &UIViewLayoutRegion)
            -> UIEdgeInsets;

        #[cfg(all(
            feature = "UIGeometry",
            feature = "UIViewLayoutRegion",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(directionalEdgeInsetsForLayoutRegion:))]
        #[unsafe(method_family = none)]
        pub fn directionalEdgeInsetsForLayoutRegion(
            &self,
            layout_region: &UIViewLayoutRegion,
        ) -> NSDirectionalEdgeInsets;
    );
}

/// CornerConfiguration.
#[cfg(feature = "UIResponder")]
impl UIView {
    extern_methods!(
        #[cfg(feature = "UICornerConfiguration")]
        /// A configuration that defines the corners of the view.
        #[unsafe(method(cornerConfiguration))]
        #[unsafe(method_family = none)]
        pub fn cornerConfiguration(&self) -> Retained<UICornerConfiguration>;

        #[cfg(feature = "UICornerConfiguration")]
        /// Setter for [`cornerConfiguration`][Self::cornerConfiguration].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCornerConfiguration:))]
        #[unsafe(method_family = none)]
        pub fn setCornerConfiguration(&self, corner_configuration: &UICornerConfiguration);

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Returns the effective radius for the given `corner`, calculated using the view's current `cornerConfiguration`.
        ///
        /// When invoked within ``UIView.layoutSubviews()``, ``UIView.updateProperties()``, or ``UIViewController.updateProperties()`` automatic invalidation will occur if the effective radius changes.
        /// If more than one `corner` is provided, the returned radius represents the maximum effective radius of those corners.
        ///
        /// - Parameter corner: The corner.
        /// - Returns: The effective radius.
        #[unsafe(method(effectiveRadiusForCorner:))]
        #[unsafe(method_family = none)]
        pub fn effectiveRadiusForCorner(&self, corner: UIRectCorner) -> CGFloat;
    );
}