mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Only use specialized Objective-C collection types when Foundation supports them.
Rely on Foundation to provide NS_ARRAY/NS_DICTIONARY/NS_SET macros that expand to either an unspecialized type (e.g., NSArray *) or a specialized one (e.g., NSArray<T> *) as appropriate for the definition of NSArray. Use these macros in the Objective-C printer. The actual names and form of these macros is still to be debated, but it's important to be able to handle both Clangs and Foundations with and without parameterized NSArray/NSDictionary/NSSet. Swift SVN r24198
This commit is contained in:
@@ -19,6 +19,7 @@ typedef double NSTimeInterval;
|
||||
|
||||
@class NSString, NSArray, NSDictionary, NSSet, NSEnumerator;
|
||||
|
||||
#define NS_ARRAY(...) NSArray<__VA_ARGS__> *
|
||||
@interface NSArray<ObjectType> : NSObject
|
||||
- (ObjectType)objectAtIndexedSubscript:(NSUInteger)idx;
|
||||
- description;
|
||||
@@ -41,6 +42,7 @@ typedef double NSTimeInterval;
|
||||
- (id)copyWithZone:(NSZone *)zone;
|
||||
@end
|
||||
|
||||
#define NS_DICTIONARY(...) NSDictionary<__VA_ARGS__> *
|
||||
@interface NSDictionary<KeyType : id<NSCopying>, ObjectType> : NSObject /*<NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>*/
|
||||
@property (readonly) NSUInteger count;
|
||||
- (ObjectType)objectForKey:(KeyType)aKey;
|
||||
@@ -63,6 +65,7 @@ typedef double NSTimeInterval;
|
||||
- (void)setObject:(ObjectType)obj forKeyedSubscript:(KeyType)key;
|
||||
@end
|
||||
|
||||
#define NS_SET(...) NSSet<__VA_ARGS__> *
|
||||
@interface NSSet<KeyType> : NSObject
|
||||
- (instancetype)init;
|
||||
- (NSUInteger)count;
|
||||
|
||||
Reference in New Issue
Block a user