File: Foundation.h

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (1243 lines) | stat: -rw-r--r-- 42,490 bytes parent folder | download
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
#if __has_feature(modules)
@import ObjectiveC;
@import CoreFoundation;
@import CoreGraphics;
#else
#import <objc/NSObject.h>
#import <CoreFoundation.h>
#import <CoreGraphics.h>
#endif
#import <stdbool.h>

#define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))

#define NS_NOESCAPE CF_NOESCAPE

typedef struct objc_object { void *isa; } *id;

typedef struct _NSZone NSZone;
void *allocate(NSZone *zone);

typedef double NSTimeInterval;

typedef struct _NSRange {
    NSUInteger location;
    NSUInteger length;
} NSRange;


extern NSUInteger NSRealMemoryAvailable(void) __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.8,message="" ))) __attribute__((availability(ios,introduced=2.0 ,deprecated=6.0,message="" )));
extern NSUInteger SomeCrazyAppExtensionForbiddenAPI(void)
  __attribute__((availability(macosx_app_extension,unavailable,message="Not available in App Extensions")))
  __attribute__((availability(ios_app_extension,unavailable,message="Not available in App Extensions")))
  __attribute__((availability(xros_app_extension,unavailable,message="Not available in App Extensions")));

extern NSString *const globalStringAvailableOn51 __attribute__((availability(macosx,introduced=51)));
extern NSString *const globalStringAvailableOn52 __attribute__((availability(macosx,introduced=52)));

__attribute__((availability(macosx,introduced=51)))
@interface NSAvailableOn51 : NSObject
- (instancetype)init;
- (instancetype)initWithStringOn52:(NSString *)s __attribute__((availability(macosx,introduced=52)));

@property NSInteger propertyOn52 __attribute__((availability(macosx,introduced=52)));

- (void)methodAvailableOn52 __attribute__((availability(macosx,introduced=52)));
@end

extern NSAvailableOn51 *const globalClassInstanceAvailableOn51 __attribute__((availability(macosx,introduced=51)));

__attribute__((availability(macosx,introduced=51)))
@protocol NSProtocolAvailableOn51

@end

__attribute__((availability(macosx,introduced=10.9)))
@interface NSAvailableOn10_9 : NSObject

@property NSInteger propertyOn10_9;

// Properties with unavailable accessors declared before property.
- (void)setPropertyOn51WithSetterOn52Before:(NSInteger)prop __attribute__((availability(macosx,introduced=52)));
@property NSInteger propertyOn51WithSetterOn52Before __attribute__((availability(macosx,introduced=51)));

- (NSInteger)propertyOn51WithGetterOn52Before __attribute__((availability(macosx,introduced=52)));
@property NSInteger propertyOn51WithGetterOn52Before __attribute__((availability(macosx,introduced=51)));

// Properties with unavailable accessors declared after property.
@property NSInteger propertyOn51WithSetterOn52After __attribute__((availability(macosx,introduced=51)));
- (void)setPropertyOn51WithSetterOn52After:(NSInteger)prop __attribute__((availability(macosx,introduced=52)));

@property NSInteger propertyOn51WithGetterOn52After __attribute__((availability(macosx,introduced=51)));
- (NSInteger)propertyOn51WithGetterOn52After __attribute__((availability(macosx,introduced=52)));

// Property with redeclared with a setter in a category
@property(readonly) NSInteger readOnlyRedeclaredWithSetterInCategory __attribute__((availability(macosx,introduced=51)));

- (void)methodAvailableOn52 __attribute__((availability(macosx,introduced=52)));
@end

@interface NSAvailableOn10_9 (NSWithPropertyReclarationInACategory)

@property(readwrite) NSInteger readOnlyRedeclaredWithSetterInCategory __attribute__((availability(macosx,introduced=51)));
- (void)setReadOnlyRedeclaredWithSetterInCategory:(NSInteger)prop __attribute__((availability(macosx,introduced=52)));
@end

/// Aaa.  NSAvailableOnOSX51AndIOS8_0.  Bbb.
__attribute__((availability(macosx,introduced=51)))
__attribute__((availability(ios,introduced=8.0)))
@interface NSAvailableOnOSX51AndIOS8_0 : NSObject

@end

@class NSString, NSArray, NSDictionary, NSSet, NSEnumerator;

@class NSMutableArray<ObjectType>;

/// Aaa.  NSArray.  Bbb.
@interface NSArray<ObjectType> : NSObject
- (instancetype)initWithObjects:(const ObjectType _Nonnull [_Nullable])objects
                          count:(NSUInteger)cnt NS_DESIGNATED_INITIALIZER;
- (nonnull ObjectType)objectAtIndexedSubscript:(NSUInteger)idx;
- description;
- (void)makeObjectsPerformSelector:(nonnull SEL)aSelector;
- (void)makeObjectsPerformSelector:(nonnull SEL)aSelector withObject:(nullable ObjectType)anObject;
- (void)makeObjectsPerformSelector:(nonnull SEL)aSelector withObject:(nullable ObjectType)anObject withObject:(nullable ObjectType)anotherObject;
- (nonnull NSMutableArray<ObjectType> *)mutableCopy;
@end

@interface NSArray<ObjectType>(NSArrayCreation)
+ (instancetype)arrayWithObjects:(const ObjectType _Nonnull [_Nullable])objects
                           count:(NSUInteger)cnt;
@end

@interface NSArray (AddingObject)
- (NSInteger)indexOfObject:(nonnull id)object;
@end

@interface DummyClass : NSObject
- (nonnull id)objectAtIndexedSubscript:(NSUInteger)idx;
- description;

@property NSString *nsstringProperty;
@property BOOL boolProperty;
@property NSArray *arrayProperty;
@property NSDictionary *dictProperty;
@property NSSet *setProperty;

- (nonnull NSString*) fetchNonnullString;
- (nullable NSString*) fetchNullableString;
- (null_unspecified NSString*) fetchNullproneString;

- (void) takeNonnullString: (nonnull NSString*) string;
- (void) takeNullableString: (nullable NSString*) string;
- (void) takeNullproneString: (null_unspecified NSString*) string;

@property(readwrite) _Nonnull NSString *nonnullStringProperty;
@property(readwrite) _Nullable NSString *nullableStringProperty;
@property(readwrite) _Null_unspecified NSString *nullproneStringProperty;

@end

@interface DummyClass (Extras)
@property NSString *nsstringProperty2;
@end

@interface NSCoder : NSObject
@end

@protocol NSCoding
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)aCoder;
@end

@protocol NSSecureCoding <NSCoding>
@end

@protocol NSCopying
- (id)copyWithZone:(nullable NSZone *)zone;
@end

@protocol NSMutableCopying
- (id)mutableCopyWithZone:(nullable NSZone *)zone;
@end

@interface NSDictionary<KeyType, ObjectType> : NSObject /*<NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>*/
@property (readonly) NSUInteger count;
- (nullable ObjectType)objectForKey:(nonnull KeyType)aKey;
- (nonnull NSEnumerator *)keyEnumerator;
@end
@interface NSDictionary<KeyType, ObjectType> (NSExtendedDictionary)
- (nullable ObjectType)objectForKeyedSubscript:(nonnull KeyType)key;
@end

@interface NSDictionary (Inits)
- (nonnull instancetype)init;
@end

@interface NSMutableDictionary<KeyType : id<NSCopying>, ObjectType> : NSDictionary<KeyType, ObjectType>
- (void)removeObjectForKey:(nonnull KeyType)aKey;
- (void)setObject:(nonnull ObjectType)anObject forKey:(nonnull KeyType)aKey;
@end

@interface NSMutableDictionary<KeyType, ObjectType> (NSExtendedMutableDictionary)
- (void)setObject:(nullable ObjectType)obj forKeyedSubscript:(nonnull KeyType)key;
@end

@interface NSSet<KeyType> : NSObject
- (nonnull instancetype)init;
- (NSUInteger)count;
- (nonnull KeyType)anyObject;
- (nonnull instancetype)initWithArray:(nonnull NSArray<KeyType> *)array;
@end

@interface NSMutableSet<KeyType> : NSSet<KeyType>
- (void)addObject:(KeyType)obj;
- (void)removeObject:(KeyType)obj;
@end

@interface NSCountedSet<KeyType> : NSMutableSet<KeyType> 
- (instancetype)initWithCapacity:(NSUInteger)numItems NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithArray:(NSArray<KeyType> *)array;
@end

@interface NSValue : NSObject <NSCopying>
@end

@interface NSValue (NSRange)
- (NSValue *)valueWithRange:(NSRange)range;
@property NSRange rangeValue;
@end

typedef __INT32_TYPE__ int32_t;

@interface NSNumber : NSValue
+ (nonnull NSNumber *)numberWithInt:(int)value;
+ (nonnull NSNumber *)numberWithInteger:(NSInteger)value;
+ (nonnull NSNumber *)numberWithUnsignedInteger:(NSUInteger)value;
+ (nonnull NSNumber *)numberWithDouble:(double)value;

- (nonnull NSNumber *)initWithInteger:(NSInteger)value;
- (nonnull NSNumber *)initWithUnsignedInteger:(NSUInteger)value;
- (nonnull NSNumber *)initWithDouble:(double)value;
- (nonnull NSNumber *)addDouble:(double)value;
- (nonnull NSNumber *)addBool:(BOOL)value;

- (nonnull NSNumber *)addUInt16:(unsigned short)value;
- (nonnull NSNumber *)addInt:(int)value;
- (nonnull NSNumber *)subtractInt32:(int32_t)value;

@property NSInteger integerValue;
@property NSUInteger unsignedIntegerValue;
@end

@interface NSDecimalNumber : NSObject
+ (instancetype)initWithMantissa:(unsigned long long)mantissa exponent:(short)exponent isNegative:(BOOL)isNegative;
+ (NSDecimalNumber *)decimalNumberWithMantissa:(unsigned long long)mantissa exponent:(short)exponent isNegative:(BOOL)isNegative;
@end

@interface NSError : NSObject
@property (readonly, nonnull) NSString *domain;
@property (readonly) NSInteger code;
- (nonnull instancetype)initWithDomain:(nonnull NSString *)domain code:(NSInteger)code userInfo:(nullable NSDictionary *)userInfo;
@end

@interface NSString : NSObject <NSSecureCoding, NSCopying>
- (void)onlyOnNSString;
+ (instancetype)stringWithContentsOfFile:(NSString*)path error:(NSError**)error;
+ (instancetype)stringWithContentsOfFile:(NSString*)path encoding:(int)encoding error:(NSError**)error;

+ (instancetype)stringWithPath:(NSString*)path;
+ (nullable instancetype)stringWithPath:(NSString*)path encoding:(int)encoding;
@end

__attribute__((warn_unused_result)) NSString *NSStringToNSString(NSString *str);

@interface Bee : NSObject
-(void)buzz;
@end

@interface Hive : NSObject {
  Bee *queen;
}
- init;
- (instancetype)initWithCoder:(NSCoder *)aDecoder;

@property (nonnull) NSArray<Bee *> *bees;
@property (nullable) NSDictionary<NSString *, Bee *> *beesByName;
@property (nonnull) NSSet<Bee *> *allBees;
@property (nonnull) NSDictionary<id <NSCopying>, Bee *> *anythingToBees;

@property(getter=isMakingHoney) BOOL makingHoney;
@property(readonly,getter=isEmpty) bool empty;
@property(setter=assignGuard:) id guard;

+ (instancetype)hiveWithQueen:(Bee *)queen;
+ (instancetype)hiveWithFlakyQueen:(Bee *)queen error:(NSError **)error;

- (instancetype)visit;
@end

@interface NSMutableString : NSString
@end

@interface NSURL : NSObject
- (instancetype)URLWithString:(NSString *)URLString;
+ (instancetype)URLWithString:(NSString *)URLString;
- (BOOL)getResourceValue:(out id _Nullable *)value
                  forKey:(NSString *)key
                   error:(out NSError *_Nullable *)error;
@end

// An all-initials name like NSURL or NSUUID, but one that isn't bridged.
@interface NSGUID : NSObject
@end

@interface NSAttributedString : NSString
- (NSAttributedString *)sliceAttributedString:(NSInteger)startIndex;
@end

BOOL BOOLtoBOOL(BOOL b);

typedef CGPoint NSPoint;
typedef CGSize NSSize;
typedef CGRect NSRect;
typedef NSPoint *NSPointArray;

@interface BadCollection
- (id)objectForKeyedSubscript:(id)key;
- (void)setObject:(id)object forKeyedSubscript:(NSString *)key;
@end

@interface BadCollectionParent
- (id)objectForKeyedSubscript:(NSString *)key;
@end

@interface BadCollectionChild : BadCollectionParent
- (void)setObject:(id)object forKeyedSubscript:(id)key;
@end

@interface ReadOnlyCollectionChild : BadCollectionParent
- (void)setObject:(id)object forKeyedSubscript:(id)key;
@end

//===---
// Enums.
//===---

#define NS_ENUM(_type, _name) CF_ENUM(_type, _name)
#define NS_OPTIONS(_type, _name) CF_OPTIONS(_type, _name)

/// Aaa.  NSRuncingMode.  Bbb.
typedef NS_ENUM(NSUInteger, NSRuncingMode) {
  NSRuncingMince,
  NSRuncingQuince
};

typedef NS_ENUM(int, NSUnderlyingType) {
  NSUnderlyingTypeZim,
  NSUnderlyingTypeZang,
  NSUnderlyingTypeFoo = 11,
  NSUnderlyingTypeBar = 22,
  NSUnderlyingTypeBas
};

typedef NS_ENUM(unsigned, NSUnsignedUnderlyingTypeNegativeValue) {
  NSNegativeOne = -1,
  NSNegativeTwo = -2,
};

typedef NS_ENUM(NSInteger, NSPrefixWordBreak) {
  NSPrefixWordBreakBanjo,
  NSPrefixWordBreakBandana
};

typedef NS_ENUM(NSInteger, NSPrefixWordBreak2) {
  NSPrefixWordBreakBarBas,
  NSPrefixWordBreakBareBass,
};

typedef NS_ENUM(NSInteger, NSPrefixWordBreak3) {
  NSPrefixWordBreak1Bob,
  NSPrefixWordBreak1Ben,
};

typedef NS_ENUM(NSInteger, NSPrefixWordBreakCustom) {
  PrefixWordBreakProblemCase __attribute__((swift_name("problemCase"))),
  NSPrefixWordBreakDeprecatedGoodCase __attribute__((deprecated)),
};

typedef NS_ENUM(NSInteger, NSPrefixWordBreak2Custom) {
  PrefixWordBreak2ProblemCase __attribute__((swift_name("problemCase"))),
  PrefixWordBreak2DeprecatedBadCase __attribute__((deprecated)),
  NSPrefixWordBreak2DeprecatedGoodCase __attribute__((deprecated)),
  NSPrefixWordBreak2GoodCase,
};

typedef NS_ENUM(NSInteger, NSPrefixWordBreakReversedCustom) {
  NSPrefixWordBreakReversedDeprecatedGoodCase __attribute__((deprecated)),
  PrefixWordBreakReversedProblemCase __attribute__((swift_name("problemCase"))),
};

typedef NS_ENUM(NSInteger, NSPrefixWordBreakReorderedCustom) {
  PrefixWordBreakReorderedProblemCase __attribute__((swift_name("problemCase"))),
  NSPrefixWordBreakReorderedGoodCase,
  PrefixWordBreakReorderedDeprecatedBadCase __attribute__((deprecated)),
  NSPrefixWordBreakReorderedDeprecatedGoodCase __attribute__((deprecated)),
};

typedef NS_ENUM(NSInteger, NSPrefixWordBreakReordered2Custom) {
  PrefixWordBreakReordered2DeprecatedBadCase __attribute__((deprecated)),
  PrefixWordBreakReordered2ProblemCase __attribute__((swift_name("problemCase"))),
  NSPrefixWordBreakReordered2GoodCase,
  NSPrefixWordBreakReordered2DeprecatedGoodCase __attribute__((deprecated)),
};

typedef NS_ENUM(NSInteger, NSPrefixWordBreakForgotToDeprecate) {
  NSPrefixWordBreakNewName1,
  NSPrefixWordBreakNewName2,
  NSOldName1PrefixWordBreak = NSPrefixWordBreakNewName1, // should have been deprecated
};

typedef NS_ENUM(NSInteger, NSPrefixWordBreakInvalidWord) {
  NSPrefixWordBreakFoo,
  NSPrefixWordBreakBar,
  NSPrefixWordBreak42,  // expected prefix would have left an invalid identifier
};

// Check tiebreaking rules. In each case, the diagnostic should choose the 'Better' case over the 'Worse' case.
typedef NS_ENUM(NSInteger, NSPrefixWordBreakSuffixTieBreakers) {
  // Available preferred over unavailable.
  NSPrefixWordBreakBetterForTest1,
  NSPrefixWordBreakWorseForTest1 __attribute__((unavailable)),

  // Un-deprecated preferred over deprecated.
  NSPrefixWordBreakBetterForTest2,
  NSPrefixWordBreakWorseForTest2 __attribute__((deprecated)),

  // Shorter preferred over longer (it's a closer match).
  NSPrefixWordBreakBetterForTest3,
  NSPrefixWordBreakWorseXXXForTest3,

  // Alphabetically first preferred over second (arbitrary tiebreaker).
  NSPrefixWordBreakBetterForTest4,
  NSPrefixWordBreakWorseXForTest4,

  // Make sure we're not choosing based on ordering.
  NSPrefixWordBreakWorseXForTest5,
  NSPrefixWordBreakBetterForTest5,
};

typedef NS_OPTIONS(NSInteger, NSPrefixWordBreakOptions) {
  NSPrefixWordBreakNewOption1 = 0x1,
  NSPrefixWordBreakNewOption2 = 0x2,
  NSOldOption1PrefixWordBreak = NSPrefixWordBreakNewOption1, // should have been deprecated
};

typedef NS_ENUM(NSInteger, NSSwiftNameAllTheThings) {
  NSSwiftNameAllTheThingsA __attribute__((swift_name("Foo"))),
  NSSwiftNameAllTheThingsB __attribute__((swift_name("Bar"))),
};

typedef NS_ENUM(NSInteger, NSSwiftNameBad) {
  NSSwiftNameBadA __attribute__((swift_name("class"))),
};


typedef NS_ENUM(NSInteger, NSSingleConstantEnum) {
  NSSingleConstantValue,
};

typedef NS_ENUM(unsigned char, NSAliasesEnum) {
  NSAliasesOriginal = 129,
  NSAliasesBySameValue = 129,
  NSAliasesByEquivalentValue = -127,
  NSAliasesByName = NSAliasesOriginal,
  NSAliasesDifferentValue = 2
};

typedef NS_ENUM(unsigned char, NSUnavailableAliasesEnum) {
  NSUnavailableAliasesOriginalAU = 0,
  NSUnavailableAliasesAliasAU __attribute__((unavailable)) = 0,
  NSUnavailableAliasesOriginalUA __attribute__((unavailable)) = 1,
  NSUnavailableAliasesAliasUA = 1,
  NSUnavailableAliasesOriginalUU __attribute__((unavailable)) = 2,
  NSUnavailableAliasesAliasUU __attribute__((unavailable)) = 2,
};

NS_ENUM(NSInteger, NSMalformedEnumMissingTypedef) {
  NSMalformedEnumMissingTypedefValue
};

@interface NSNumberFormatter : NSObject
@end

typedef NS_ENUM(NSUInteger, NSNumberFormatterBehavior) {
  NSNumberFormatterBehaviorDefault = 0,
  NSNumberFormatterBehavior10_0 = 1000,
  NSNumberFormatterBehavior10_4 = 1040,
};

@interface NSNotification : NSObject
@end

@interface NSNotificationQueue : NSObject
@end

typedef NS_ENUM(NSUInteger, NSPostingStyle) {
  NSPostWhenIdle = 1,
  NSPostASAP = 2,
  NSPostNow = 3
};

@interface NSXMLNode : NSObject
@end

typedef NS_ENUM(NSUInteger, NSXMLNodeKind) {
  NSXMLInvalidKind = 0,
  NSXMLDocumentKind,
  NSXMLElementKind,
  NSXMLAttributeKind,
  NSXMLNamespaceKind,
  NSXMLProcessingInstructionKind,
  NSXMLCommentKind,
  NSXMLTextKind,
  NSXMLDTDKind __attribute__((swift_name("DTDKind"))),
  NSXMLEntityDeclarationKind,
  NSXMLAttributeDeclarationKind,
  NSXMLElementDeclarationKind,
  NSXMLNotationDeclarationKind
};

// From CoreFoundation
typedef CF_ENUM(NSInteger, CFURLPathStyle) {
  kCFURLPOSIXPathStyle = 0,
  kCFURLHFSPathStyle /*CF_ENUM_DEPRECATED(10_0, 10_9, 2_0, 7_0)*/,
  kCFURLWindowsPathStyle
};

typedef CF_ENUM(NSInteger, CFURLOrUTI) {
  kCFURLKind,
  kCFUTIKind
};

typedef CF_ENUM(NSInteger, Magnitude) {
  k0,
  k1,
  k2,
};

typedef CF_ENUM(NSInteger, MagnitudeWords) {
  kZero,
  kOne,
  kTwo,
};


// Deliberately simple to test the overlay module.
enum {
  NSUTF8StringEncoding = 8
};


/// Aaa.  NSRuncingOptions.  Bbb.
typedef NS_OPTIONS(NSUInteger, NSRuncingOptions) {
  NSRuncingNone = 0,
  NSRuncingEnableMince = 1,
  NSRuncingEnableQuince = 2,
};

typedef NS_OPTIONS(NSUInteger, NSSingleOptions) {
  NSSingleValue = 1,
};

// From CoreFoundation
typedef CF_OPTIONS(unsigned long, CFCalendarUnit) {
  kCFCalendarUnitEra = (1UL << 1),
  kCFCalendarUnitYear = (1UL << 2),
  kCFCalendarUnitMonth = (1UL << 3),
  kCFCalendarUnitDay = (1UL << 4),
  kCFCalendarUnitHour = (1UL << 5),
  kCFCalendarUnitMinute = (1UL << 6),
  kCFCalendarUnitSecond = (1UL << 7),
  kCFCalendarUnitWeek /*CF_ENUM_DEPRECATED(10_4, 51, 2_0, 8_0)*/ = (1UL << 8),
  kCFCalendarUnitWeekday = (1UL << 9),
  kCFCalendarUnitWeekdayOrdinal = (1UL << 10),
  kCFCalendarUnitQuarter /*CF_ENUM_AVAILABLE(10_6, 4_0)*/ = (1UL << 11),
  kCFCalendarUnitWeekOfMonth /*CF_ENUM_AVAILABLE(10_7, 5_0)*/ = (1UL << 12),
  kCFCalendarUnitWeekOfYear /*CF_ENUM_AVAILABLE(10_7, 5_0)*/ = (1UL << 13),
  kCFCalendarUnitYearForWeekOfYear /*CF_ENUM_AVAILABLE(10_7, 5_0)*/ = (1UL << 14),
};

// From Foundation

typedef NS_OPTIONS(NSUInteger, NSKeyValueObservingOptions) {
  NSKeyValueObservingOptionNew = 0x01,
  NSKeyValueObservingOptionOld = 0x02,
  NSKeyValueObservingOptionInitial /*NS_ENUM_AVAILABLE(10_5, 2_0)*/ = 0x04,
  NSKeyValueObservingOptionPrior /*NS_ENUM_AVAILABLE(10_5, 2_0)*/ = 0x08
};

@interface NSCalendar : NSObject
@end

#define NS_CALENDAR_ENUM_DEPRECATED(osx_in, osx_out, ios_in, ios_out, msg) \
  __attribute__((availability(macosx, introduced=osx_in, deprecated=osx_out, message=msg))) \
  __attribute__((availability(iphoneos, introduced=ios_in, deprecated=ios_out, message=msg)))
typedef NS_OPTIONS(NSUInteger, NSCalendarUnit) {
  NSCalendarUnitEra                = kCFCalendarUnitEra,
  NSCalendarUnitYear               = kCFCalendarUnitYear,
  NSCalendarUnitMonth              = kCFCalendarUnitMonth,
  // snip
  NSCalendarUnitCalendar           = (1 << 20),

  NSEraCalendarUnit NS_CALENDAR_ENUM_DEPRECATED(10_4, 10_9, 2_0, 7_0, "Use NSCalendarUnitEra instead") = NSCalendarUnitEra,
  NSYearCalendarUnit NS_CALENDAR_ENUM_DEPRECATED(10_4, 10_9, 2_0, 7_0, "Use NSCalendarUnitYear instead") = NSCalendarUnitYear,
  NSMonthCalendarUnit NS_CALENDAR_ENUM_DEPRECATED(10_4, 10_9, 2_0, 7_0, "Use NSCalendarUnitMonth instead") = NSCalendarUnitMonth,
  // snip
  NSCalendarCalendarUnit NS_CALENDAR_ENUM_DEPRECATED(10_7, 10_9, 4_0, 7_0, "Use NSCalendarUnitCalendar instead") = NSCalendarUnitCalendar,
};

typedef NS_OPTIONS(NSUInteger, NSCalendarUnitDeprecated) {
  NSEraCalendarUnitDeprecated NS_CALENDAR_ENUM_DEPRECATED(10_4, 10_9, 2_0, 7_0, "Use NSCalendarUnitEra instead") = NSCalendarUnitEra,
  NSYearCalendarUnitDeprecated NS_CALENDAR_ENUM_DEPRECATED(10_4, 10_9, 2_0, 7_0, "Use NSCalendarUnitYear instead") = NSCalendarUnitYear,
  NSMonthCalendarUnitDeprecated NS_CALENDAR_ENUM_DEPRECATED(10_4, 10_9, 2_0, 7_0, "Use NSCalendarUnitMonth instead") = NSCalendarUnitMonth,
  // snip
  NSCalendarCalendarUnitDeprecated NS_CALENDAR_ENUM_DEPRECATED(10_7, 10_9, 4_0, 7_0, "Use NSCalendarUnitCalendar instead") = NSCalendarUnitCalendar,
};

typedef NS_OPTIONS(NSUInteger, NSOptionsAlsoGetSwiftName) {
  ThisIsAnNSOptionsCaseWithSwiftName __attribute__((swift_name("Case"))) = 0x1
};

#define CF_SWIFT_UNAVAILABLE(_msg) __attribute__((availability(swift, unavailable, message=_msg)))
#define NS_SWIFT_UNAVAILABLE(_msg) CF_SWIFT_UNAVAILABLE(_msg)

typedef NS_ENUM(NSUInteger, NSRectEdge) {
  NSRectEdgeMinX = 0,
  NSRectEdgeMinY = 1,
  NSRectEdgeMaxX = 2,
  NSRectEdgeMaxY = 3,

  NSMinXEdge NS_SWIFT_UNAVAILABLE("Use NSRectEdge.MinX instead") = NSRectEdgeMinX,
  NSMinYEdge NS_SWIFT_UNAVAILABLE("Use NSRectEdge.MinY instead") = NSRectEdgeMinY,
  NSMaxXEdge __attribute__((availability(swift, unavailable, message="Use NSRectEdge.MaxX instead"))) = NSRectEdgeMaxX,
  NSMaxYEdge __attribute__((availability(swift, unavailable, message="Use NSRectEdge.MaxY instead"))) = NSRectEdgeMaxY,
};

// From CoreBluetooth
typedef NS_OPTIONS(NSInteger, CBCharacteristicProperties) {
  CBCharacteristicPropertyBroadcast = 0x01,
  CBCharacteristicPropertyRead = 0x02,
  CBCharacteristicPropertyWriteWithoutResponse = 0x04,
  CBCharacteristicPropertyWrite = 0x08,
  CBCharacteristicPropertyNotify = 0x10,
  CBCharacteristicPropertyIndicate = 0x20,
  CBCharacteristicPropertyAuthenticatedSignedWrites = 0x40,
  CBCharacteristicPropertyExtendedProperties = 0x80,
  CBCharacteristicPropertyNotifyEncryptionRequired /*NS_ENUM_AVAILABLE(10_9, 6_0)*/ = 0x100,
  CBCharacteristicPropertyIndicateEncryptionRequired /*NS_ENUM_AVAILABLE(10_9, 6_0)*/ = 0x200
};

// From CoreMedia
typedef CF_OPTIONS(unsigned int, CMTimeFlags) {
  kCMTimeFlags_Valid = 1UL<<0,
  kCMTimeFlags_HasBeenRounded = 1UL<<1,
  kCMTimeFlags_PositiveInfinity = 1UL<<2,
  kCMTimeFlags_NegativeInfinity = 1UL<<3,
  kCMTimeFlags_Indefinite = 1UL<<4,
  kCMTimeFlags_ImpliedValueFlagsMask = kCMTimeFlags_PositiveInfinity | kCMTimeFlags_NegativeInfinity | kCMTimeFlags_Indefinite
};
typedef CF_OPTIONS(unsigned int, CMTimeFlagsWithNumber) {
  kCMTimeFlagsWithNumber_Valid = 1UL<<0,
  kCMTimeFlagsWithNumber_888 = 1UL<<1,
};


// Contrived name with a plural "-es"...normally these are "beeps".
typedef NS_OPTIONS(NSInteger, AlertBuzzes) {
  AlertBuzzNone = 0,
  AlertBuzzFunk = 1 << 0,
  AlertBuzzHero = 1 << 1,
  AlertBuzzSosumi = 1 << 2
};

// From AppKit
typedef NS_OPTIONS(NSUInteger, NSBitmapFormat) {
  NSAlphaFirstBitmapFormat            = 1 << 0, // 0 means is alpha last (RGBA, CMYKA, etc.)
  NSAlphaNonpremultipliedBitmapFormat = 1 << 1, // 0 means is premultiplied
  NSFloatingPointSamplesBitmapFormat  = 1 << 2, // 0 is integer

  NS16BitLittleEndianBitmapFormat /*NS_ENUM_AVAILABLE_MAC(51)*/ = (1 << 8),
  NS32BitLittleEndianBitmapFormat /*NS_ENUM_AVAILABLE_MAC(51)*/ = (1 << 9),
  NS16BitBigEndianBitmapFormat /*NS_ENUM_AVAILABLE_MAC(51)*/ = (1 << 10),
  NS32BitBigEndianBitmapFormat /*NS_ENUM_AVAILABLE_MAC(51)*/ = (1 << 11)
};

typedef NS_OPTIONS(NSUInteger, NSBitmapFormatReversed) {
  NS16BitLittleEndianBitmapFormatR /*NS_ENUM_AVAILABLE_MAC(51)*/ = (1 << 8),
  NS32BitLittleEndianBitmapFormatR /*NS_ENUM_AVAILABLE_MAC(51)*/ = (1 << 9),
  NS16BitBigEndianBitmapFormatR /*NS_ENUM_AVAILABLE_MAC(51)*/ = (1 << 10),
  NS32BitBigEndianBitmapFormatR /*NS_ENUM_AVAILABLE_MAC(51)*/ = (1 << 11),

  NSAlphaFirstBitmapFormatR            = 1 << 0, // 0 means is alpha last (RGBA, CMYKA, etc.)
  NSAlphaNonpremultipliedBitmapFormatR = 1 << 1, // 0 means is premultiplied
  NSFloatingPointSamplesBitmapFormatR  = 1 << 2, // 0 is integer
};

typedef NS_OPTIONS(NSUInteger, NSBitmapFormat2) {
  NSU16a = 1,
  NSU32a = 2,
};

typedef NS_OPTIONS(NSUInteger, NSBitmapFormat3) {
  NSU16b = 1,
  NSU32b = 2,
  NSS16b = 4,
  NSS32b = 8,
};

typedef NS_OPTIONS(NSUInteger, NSUBitmapFormat4) {
  NSU16c = 1,
  NSU32c = 2,
};

typedef NS_OPTIONS(NSUInteger, NSABitmapFormat5) {
  NSAA16d = 1,
  NSAB32d = 2,
};

/// Aaa.  NSPotentiallyUnavailableOptions.  Bbb.
typedef NS_OPTIONS(NSUInteger, NSPotentiallyUnavailableOptions) {
  NSPotentiallyUnavailableOptionsFirst   = (1 << 0),
  NSPotentiallyUnavailableOptionsSecond  = (1 << 1),
  NSPotentiallyUnavailableOptionsThird   = (1 << 2),
}  __attribute__((availability(macosx, introduced=51)));

/// Aaa.  NSOptionsWithUnavailableElement.  Bbb.
typedef NS_OPTIONS(NSUInteger, NSOptionsWithUnavailableElement) {
  NSOptionsWithUnavailableElementFirst    = (1 << 0),
  NSOptionsWithUnavailableElementSecond   = (1 << 1),
  NSOptionsWithUnavailableElementThird __attribute__((availability(macosx, introduced=51))) = (1 << 2),
};

/// Aaa.  NSUnavailableEnum.  Bbb.
typedef NS_ENUM(NSUInteger, NSUnavailableEnum) {
  NSUnavailableEnumFirst,
  NSUnavailableEnumSecond,
  NSUnavailableEnumThird,
}  __attribute__((availability(macosx, introduced=51)));

/// Aaa.  NSEnumWithUnavailableElement.  Bbb.
typedef NS_ENUM(NSUInteger, NSEnumWithUnavailableElement) {
  NSEnumWithUnavailableElementFirst,
  NSEnumWithUnavailableElementSecond,
  NSEnumWithUnavailableElementThird __attribute__((availability(macosx, introduced=51))),
};

typedef NS_OPTIONS(NSUInteger, NSDeprecatedOptions) {
  NSDeprecatedOptionsNone = 0,
  NSDeprecatedOptionsFirst   = (1 << 0)
}  __attribute__((availability(macosx, introduced=51, deprecated=51, message="Use a different API")));

typedef NS_ENUM(NSUInteger, NSDeprecatedEnum) {
  NSDeprecatedEnumFirst
} __attribute__((availability(macosx, introduced=51, deprecated=51, message="Use a different API")));

typedef NS_OPTIONS(NSUInteger, NSExplicitlyUnavailableOptions) {
  NSExplicitlyUnavailableOptionsNone = 0,
  NSExplicitlyUnavailableOptionsFirst   = (1 << 0)
} __attribute__((unavailable));

typedef NS_OPTIONS(NSUInteger, NSExplicitlyUnavailableOnOSXOptions) {
  NSExplicitlyUnavailableOnOSXOptionsNone = 0,
  NSExplicitlyUnavailableOnOSXOptionsFirst   = (1 << 0)
}  __attribute__((availability(macosx, unavailable, message="Use a different API")));


@interface NSClassWithDeprecatedOptionsInMethodSignature : NSObject
+ (NSClassWithDeprecatedOptionsInMethodSignature *) sharedInstance;
@end

@interface NSClassWithDeprecatedOptionsInMethodSignature (ActuallyUseOptions)
  - (void)someMethodWithDeprecatedOptions:(NSDeprecatedOptions)options __attribute__((availability(macosx, introduced=51, deprecated=51, message="Use a different API")));
@end

@interface NSClassWithExplicitlyUnavailableOptionsInMethodSignature : NSObject
+ (NSClassWithExplicitlyUnavailableOptionsInMethodSignature *) sharedInstance;
@end

@interface NSClassWithExplicitlyUnavailableOptionsInMethodSignature (ActuallyUseOptions)
- (void)someMethodWithUnavailableOptions:(NSExplicitlyUnavailableOptions)options __attribute__((unavailable));
- (void)someMethodWithUnavailableOptionsOnOSX:(NSExplicitlyUnavailableOnOSXOptions)options __attribute__((availability(macosx, unavailable, message="Use a different API")));
@end

@interface NSClassWithPotentiallyUnavailableOptionsInMethodSignature : NSObject
+ (NSClassWithPotentiallyUnavailableOptionsInMethodSignature *) sharedInstance;
- (void)someMethodWithPotentiallyUnavailableOptions:(NSPotentiallyUnavailableOptions)options __attribute__((availability(macosx, introduced=52)));
@end

@protocol NSWobbling
-(void)wobble;

- (instancetype)returnMyself; 

@optional
-(void)wibble;

- (id)objectAtIndexedSubscript:(NSUInteger)idx;
@end

@protocol NSMaybeInitWobble
@optional
- (id)initWithWobble:(int)wobble;
@end

@interface NSURLRequest : NSObject
- (instancetype)requestWithString:(NSString *)URLString;
+ (instancetype)requestWithString:(NSString *)URLString;
+ (instancetype)URLRequestWithURL:(NSURL *)URL;
@end

NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available")
@interface NSInvocation : NSObject
@end

typedef NS_ENUM(NSInteger, NSByteCountFormatterCountStyle) {
  NSByteCountFormatterCountStyleFile    = 0,
  NSByteCountFormatterCountStyleMemory  = 1,
  NSByteCountFormatterCountStyleDecimal = 2,
  NSByteCountFormatterCountStyleBinary  = 3
};

@interface NSByteCountFormatter : NSObject

@property NSByteCountFormatterCountStyle countStyle;

@end

NSArray *arrayToArray(NSArray *arr);
NSDictionary *dictToDict(NSDictionary *dict);
NSSet *setToSet(NSSet *dict);

@interface NSExtensionContext : NSObject
- (void)openURL:(NSURL *)URL completionHandler:(void (^)(BOOL success))completionHandler;
// Fake API, for testing initialisms.
- (void)openGUID:(NSGUID *)GUID completionHandler:(void (^)(BOOL success))completionHandler;
@end

@interface NSProcessInfo : NSObject
@property (class, readonly, strong, nonnull) NSProcessInfo *processInfo;
@end

@interface NSString(FoundationExts)
- (void)notBridgedMethod;
@end

@interface NSString(FoundationExts)
@property (nonatomic, copy) NSString *uppercaseString;
@end

typedef struct {
    unsigned long state;
    id __unsafe_unretained *itemsPtr;
    unsigned long *mutationsPtr;
    unsigned long extra[5];
} NSFastEnumerationState;

@protocol NSFastEnumeration

- (NSUInteger)countByEnumeratingWithState:(nonnull NSFastEnumerationState *)state objects:(id __unsafe_unretained [])buffer count:(NSUInteger)len;

@end

typedef const void * CFTypeRef;
typedef const struct __attribute__((objc_bridge(NSString))) __CFString * CFStringRef;
typedef const struct __attribute__((objc_bridge(NSDictionary))) __CFDictionary * CFDictionaryRef;
typedef struct CGColor *CGColorRef;

extern CFTypeRef CFRetain(CFTypeRef cf);
extern void CFRelease(CFTypeRef cf);
extern CFTypeRef CFAutorelease(CFTypeRef __attribute__((cf_consumed)) arg) __attribute__((availability(macosx,introduced=10.9)));
extern CGColorRef CGColorRetain(CGColorRef color) __attribute__((availability(macosx,introduced=10.3)));
extern void CGColorRelease(CGColorRef color) __attribute__((availability(macosx,introduced=10.3)));

@interface NSObject (NSDistributedObjects)
@property (readonly) Class classForPortCoder NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead");
@end

typedef NSString *_Nonnull NSNotificationName
    __attribute((swift_newtype(struct)));

NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
extern NSString * const NSConnectionReplyMode;
NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
extern NSString * const NSConnectionDidDieNotification;
NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
@interface NSConnection : NSObject {
}
@end
NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
@interface NSPortCoder : NSCoder
@end
NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
@protocol NSConnectionDelegate <NSObject>
@end
NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
@interface NSDistantObjectRequest : NSObject
@end
NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
@interface NSDistantObject
@end
NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
@interface NSPortNameServer : NSObject
@end
NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
@interface NSMachBootstrapServer : NSPortNameServer
@end
NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
@interface NSMessagePortNameServer : NSPortNameServer
@end
NS_SWIFT_UNAVAILABLE("Use NSXPCConnection instead")
@interface NSSocketPortNameServer : NSPortNameServer
@end
NS_SWIFT_UNAVAILABLE("Use NSCalendar and NSDateComponents and NSDateFormatter instead")
@interface NSCalendarDate : NSDate
@end
NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available")
@interface NSInvocationOperation : NSObject
@end
NS_SWIFT_UNAVAILABLE("NSInvocation and related APIs not available")
@interface NSMethodSignature : NSObject
@end
/// Unavailable Global Functions
extern void NSSetZoneName(NSZone *_Nonnull zone, NSString *_Nonnull name)
    NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
extern NSString *NSZoneName(NSZone *zone) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");
extern NSZone *NSCreateZone(NSUInteger startSize, NSUInteger granularity, BOOL canFree) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");

@interface NSXPCInterface : NSObject
+ (NSXPCInterface *)interfaceWithProtocol:(Protocol *)protocol;
@end

typedef struct NonNilableReferences {
  NSObject *_Nonnull __unsafe_unretained obj;
} NonNilableReferences;


@protocol NSProtocolWithOptionalRequirement
@optional
-(void)optionalRequirement;
-(DummyClass *)optionalRequirementMethodWithIUOResult;
@end

@interface NSClassWithMethodFromNSProtocolWithOptionalRequirement
-(void)optionalRequirement  __attribute__((availability(macosx, introduced=51)));
@end

__attribute__((availability(macosx, introduced = 51)))
@interface AnnotatedFrameworkClass : NSObject
@end

__attribute__((availability(macosx, introduced = 52)))
@interface AnnotatedLaterFrameworkClass : NSObject
@end

/// Aaa.  UnannotatedFrameworkProtocol.  Bbb.
@protocol UnannotatedFrameworkProtocol
- (void)doSomethingWithClass:(AnnotatedFrameworkClass *_Nullable)k;
- (void)doSomethingWithNonNullableClass:(AnnotatedFrameworkClass *_Nonnull)k;
- (void)doSomethingWithIUOClass:(AnnotatedFrameworkClass *_Null_unspecified)k;
- (AnnotatedFrameworkClass *_Nullable)returnSomething;

-(void)noUnavailableTypesInSignature;

- (void)doSomethingWithClass:(AnnotatedFrameworkClass *_Nonnull)k
               andLaterClass:(AnnotatedLaterFrameworkClass *_Nonnull)lk;

-(void)someMethodWithAvailability __attribute__((availability(macosx,introduced=53)));

@property(nonnull) AnnotatedFrameworkClass *someProperty;

@end

/// Aaa.  AnnotatedFrameworkProtocol.  Bbb.
__attribute__((availability(macosx, introduced = 10.9)))
@protocol AnnotatedFrameworkProtocol
- (AnnotatedFrameworkClass * _Nullable) returnSomething;
@end

/// Aaa.  FrameworkClassConformingToUnannotatedFrameworkProtocol.  Bbb.
@interface FrameworkClassConformingToUnannotatedFrameworkProtocol : NSObject<UnannotatedFrameworkProtocol>
@end

/// Aaa.  LaterFrameworkClassConformingToUnannotatedFrameworkProtocol.  Bbb.
__attribute__((availability(macosx, introduced = 52)))
@interface LaterFrameworkClassConformingToUnannotatedFrameworkProtocol : NSObject<UnannotatedFrameworkProtocol>
@end

/// Aaa.  LaterAnnotatedFrameworkProtocol.  Bbb.
__attribute__((availability(macosx, introduced = 52)))
@protocol LaterAnnotatedFrameworkProtocol
- (AnnotatedFrameworkClass * _Nullable) returnSomething;
- (void)doSomethingWithClass:(AnnotatedFrameworkClass *_Nonnull)k
               andLaterClass:(AnnotatedLaterFrameworkClass *_Nonnull)lk;
-(void)noUnavailableTypesInSignature;
-(void)someMethodWithAvailability __attribute__((availability(macosx,introduced=53)));
@property(nonnull) AnnotatedFrameworkClass *someProperty;
@end

/// Aaa.  FrameworkClassConformingToLaterAnnotatedFrameworkProtocol.  Bbb.
@interface FrameworkClassConformingToLaterAnnotatedFrameworkProtocol : NSObject<LaterAnnotatedFrameworkProtocol>
@end

@interface UnusedResults : NSObject
-(NSInteger)producesResult __attribute__((warn_unused_result));
@end

@interface NSObject (Silly)
- (void)doSelector:(nonnull SEL)selector;
@end

@interface Bee (Gerunds)
- (void)startSquashingBee:(nonnull Bee *)bee;
- (void)startSoothingBee:(nonnull Bee *)bee;
- (void)startShoppingBee:(nonnull Bee *)bee;
@end

@interface NSMutableArray<ObjectType> : NSArray
- (void)addObjects:(nonnull NSArray<ObjectType> *)objects;
@end

@interface NSString (Slicing)
- (nonnull NSString *)sliceFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex;
@end

@interface NSString (Appending)
- (nonnull NSString *)stringByAppendingString:(nonnull NSString *)string;
- (nonnull NSString *)stringWithString:(nonnull NSString *)string;
- (nullable NSURL *)URLWithAddedString:(nonnull NSString *)string;
// Fake API for testing initialisms.
- (nullable NSGUID *)GUIDWithAddedString:(nonnull NSString *)string;
- (NSString *)stringForCalendarUnits:(NSCalendarUnit)units;
@end

@interface NSURL (Properties)
@property (readonly, nullable) NSURL *URLByDeletingLastPathComponent;
@property (readonly, nonnull) NSURL *URLWithHTTPS;
@end

@interface NSGUID (Properties)
@property (readonly, nullable) NSGUID *GUIDByCanonicalizing;
@property (readonly, nonnull) NSGUID *GUIDWithContext;
@end

typedef NS_OPTIONS(NSUInteger, NSEnumerationOptions) {
   NSEnumerationConcurrent = (1UL << 0),
   NSEnumerationReverse = (1UL << 1),
};

@interface NSArray (Enumeration)
- (void)enumerateObjectsUsingBlock:(void (^)(id obj,
                                             NSUInteger idx,
                                             BOOL *stop))block;

- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts
                         usingBlock:(void (^)(id obj, NSUInteger idx,
                                              BOOL *stop))block;

- (void)enumerateObjectsRandomlyWithBlock:
    (void (^_Nullable)(id obj, NSUInteger idx, BOOL *stop))block;

- (void)enumerateObjectsHaphazardly:(void (^_Nullable)(id obj, NSUInteger idx,
                                                       BOOL *stop))block;

- (void)optionallyEnumerateObjects:(NSEnumerationOptions)opts
                              body:(void (^)(id obj, NSUInteger idx,
                                             BOOL *stop))block;

- (void)enumerateObjectsWhileOrderingPizza:(BOOL)pizza
                         withOptions:(NSEnumerationOptions)opts
                         usingBlock:(void (^)(id obj, NSUInteger idx,
                                              BOOL *stop))block;

- (void)doSomethingWithCopying:(nonnull id<NSCopying>)copying;
- (void)doSomethingElseWithCopying:(nonnull NSObject<NSCopying> *)copying;

- (void)enumerateObjectsWithNullableBlock:
    (void (^_Nullable)(id obj, NSUInteger idx, BOOL *stop))block;
@end

@interface NSMutableArray (Sorting)
- (void)sortUsingFunction:(NSInteger (*_Nonnull)(_Nonnull id,
                                                 _Nonnull id))fimctopn;
@end

@interface NSMutableArray (Removal)
- (void)removeObjects:(nonnull NSArray *)objects;
@end

@interface NSMutableArray (TypeSuffix)
- (void)doSomethingWithUnderlying:(NSUnderlyingType)underlying;
- (void)setDefaultEnumerationOptions:(NSEnumerationOptions)options;
@end

@interface NSString ()
- (nonnull NSString *)stringByNormalizingXMLPreservingComments:(BOOL)preserveFlag;
@end

@interface NSSet ()
- (nonnull NSSet *)setByAddingObject:(nonnull id)object;
@property (readonly) BOOL empty;
- (BOOL)nonEmpty;
@property (readonly) BOOL isStringSet;
@property (readonly) BOOL wantsAUnion;
@property (readonly) BOOL watchesItsLanguage;
@property (readonly) BOOL appliesForAJob;
@property (readonly) BOOL setShouldBeInfinite;
@end

int variadicFunc1(int A, ...);

int variadicFunc2(int A, ...);

@interface NSString (UTF8)
-(nullable instancetype)initWithUTF8String:(const char *)bytes;
@end

extern NSString *NSGlobalConstant;
extern void NSGlobalFunction(void);

extern void NS123(void);
extern void NSYELLING(void);
extern void NS_SCREAMING(void);
extern void NS_(void);
extern NSString *NSHTTPRequestKey;

@interface NSString (URLExtraction)
@property (nonnull,copy,readonly) NSArray<NSURL *> *URLsInText;
@property (nonnull,copy,readonly) NSArray<NSGUID *> *GUIDsInText;
@end

@interface NSObject (Selectors)
- (void)messageSomeObject:(nonnull id)object selector:(nonnull SEL)selector;
@end

@interface NSOperation : NSObject
@end

@interface NSProgress : NSObject
@end

@protocol NSProgressReporting <NSObject>
@property (readonly) NSProgress *progress;
@end

@interface NSIdLover: NSObject

- (id _Nonnull)makesId;
- (void)takesId:(id _Nonnull)x;
- (void)takesArrayOfId:(const id _Nonnull * _Nonnull)x;
- (void)takesNullableId:(id _Nullable)x;

@property (strong) id propertyOfId;

@end

@protocol NSIdLoving
- (void)takesIdViaProtocol:(id _Nonnull)x;
@end

#define NSTimeIntervalSince1970 978307200.0
#define NS_DO_SOMETHING 17

typedef NS_ENUM(NSUInteger, NSClothingStyle) {
  NSClothingStyleFormal = 0,
  NSClothingStyleSemiFormal,
  NSClothingStyleHipster,
  NSClothingStyleHippie
};
static const NSClothingStyle NSClothingStyleOfficeCasual __attribute__((availability(swift,unavailable,replacement="NSClothingStyleSemiFormal"))) = NSClothingStyleSemiFormal;

void acceptError(NSError * _Nonnull error);
NSError * _Nonnull produceError(void);
NSError * _Nullable produceOptionalError(void);

extern NSString * const FictionalServerErrorDomain;

typedef enum __attribute__((ns_error_domain(FictionalServerErrorDomain))) FictionalServerErrorCode : NSInteger {
  FictionalServerErrorMeltedDown = 1
} FictionalServerErrorCode;

@protocol Wearable
- (void)wear;
@end

@protocol Garment
@end

@protocol Cotton
@end

@interface Coat : NSObject<Wearable>

- (void)wear;
@property (class) Coat <Wearable> *fashionStatement;

@end

@protocol NSLaundry
- (void)wash:(Coat <Garment> * _Nonnull)garment;
- (void)bleach:(Coat <Garment, Cotton> * _Nonnull)garment;
- (Coat <Garment> * _Nonnull)dry;
@end

@interface NSLaundromat : NSObject
@end

extern NSString * const NSLaundryErrorDomain;

typedef enum __attribute__((ns_error_domain(NSLaundryErrorDomain))) __attribute__((swift_name("NSLaundromat.Error"))) NSLaundryErrorCode {
    NSLaundryErrorTooMuchSoap = 1,
    NSLaundryErrorCatInWasher = 2
};

typedef void (*event_handler)(_Nonnull id);
void install_global_event_handler(_Nullable event_handler handler);

@interface NSObject ()
- (void) addObserver: (id) observer
         forKeyPath: (NSString*) keyPath
         options: (NSInteger) options
         context: (void*) context;
- (void) removeObserver: (id) observer
         forKeyPath: (NSString*) keyPath
         context: (void*) options;
@end

_Nullable id returnNullableId(void);
void takeNullableId(_Nullable id);

@interface I
@end

@protocol OptionalRequirements
@optional
- (Coat *)optional;
@property NSString *name;
@end

@interface IUOProperty
@property (readonly) id<OptionalRequirements> iuo;
@end

@interface ColorDescriptor : NSObject <NSCopying>
@end

@interface ColorArray : NSObject
- (ColorDescriptor *)objectAtIndexedSubscript:(NSUInteger)attachmentIndex;
- (void)setObject:(nullable ColorDescriptor *)attachment atIndexedSubscript:(NSUInteger)attachmentIndex;
@end

@interface PaletteDescriptor : NSObject <NSCopying>
@property (readonly, nonnull) ColorArray *colors;
@end