mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The Swift name lookup tables and the complete Objective-C "container" to Swift DeclContext mapping code used similar-but-different logic to determine when to suppress a declaration (e.g., when suppressing the accessors for a property). Centralize the logic so we get the same behavior in both places.
76 lines
2.3 KiB
Objective-C
76 lines
2.3 KiB
Objective-C
@import Foundation;
|
|
|
|
#define SWIFT_NAME(X) __attribute__((swift_name(#X)))
|
|
|
|
#ifndef SWIFT_ENUM_EXTRA
|
|
# define SWIFT_ENUM_EXTRA
|
|
#endif
|
|
|
|
#ifndef SWIFT_ENUM
|
|
# define SWIFT_ENUM(_type, _name) \
|
|
enum _name : _type _name; \
|
|
enum SWIFT_ENUM_EXTRA _name : _type
|
|
#endif
|
|
|
|
// Renaming classes
|
|
SWIFT_NAME(SomeClass)
|
|
@interface SNSomeClass : NSObject
|
|
- (instancetype)initWithFloat:(float)f;
|
|
- (instancetype)initWithDefault;
|
|
- (void)instanceMethodWithX:(float)x Y:(float)y Z:(float)z;
|
|
+ (instancetype)someClassWithDouble:(double)d;
|
|
+ (instancetype)someClassWithTry:(BOOL)shouldTry;
|
|
+ (NSObject *)buildWithObject:(NSObject *)object SWIFT_NAME(init(object:));
|
|
+ (instancetype)buildWithUnsignedChar:(unsigned char)uint8 SWIFT_NAME(init(uint8:));
|
|
@property (readonly,nonatomic) float floatProperty;
|
|
@property (readwrite,nonatomic) double doubleProperty;
|
|
@end
|
|
|
|
SWIFT_NAME(SomeProtocol)
|
|
@protocol SNSomeProtocol
|
|
- (void)protoInstanceMethodWithX:(float)x y:(float)y;
|
|
@end
|
|
|
|
@interface SNSomeClass ()
|
|
- (void)extensionMethodWithX:(float)x y:(float)y;
|
|
@end
|
|
|
|
@interface SNSomeClass (Category1) <SNSomeProtocol>
|
|
- (void)categoryMethodWithX:(float)x y:(float)y;
|
|
- (void)categoryMethodWithX:(float)x y:(float)y z:(float)z;
|
|
- (id)objectAtIndexedSubscript:(NSInteger)index;
|
|
@end
|
|
|
|
@interface SNCollision
|
|
@end
|
|
|
|
@protocol SNCollision
|
|
@property (readonly,nonnull) id reqSetter;
|
|
- (void)setReqSetter:(nonnull id)bar;
|
|
|
|
@property (readonly,nonnull) id optSetter;
|
|
@optional
|
|
- (void)setOptSetter:(nonnull id)bar;
|
|
@end
|
|
|
|
@protocol NSAccessibility
|
|
@property (nonatomic) float accessibilityFloat;
|
|
@end
|
|
|
|
@interface UIActionSheet : NSObject
|
|
-(instancetype)initWithTitle:(const char *)title delegate:(id)delegate cancelButtonTitle:(const char *)cancelButtonTitle destructiveButtonTitle:(const char *)destructiveButtonTitle otherButtonTitles:(const char *)otherButtonTitles, ...;
|
|
@end
|
|
|
|
@interface NSError : NSObject
|
|
@end
|
|
|
|
@interface NSErrorImports : NSObject
|
|
- (nullable NSObject *)methodAndReturnError:(NSError **)error;
|
|
- (BOOL)methodWithFloat:(float)value error:(NSError **)error;
|
|
- (nullable instancetype)initAndReturnError:(NSError **)error;
|
|
- (nullable instancetype)initWithFloat:(float)value error:(NSError **)error;
|
|
@end
|
|
|
|
typedef const void *CFTypeRef __attribute__((objc_bridge(id)));
|
|
typedef const struct __attribute__((objc_bridge(id))) __CCItem *CCItemRef;
|