mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
...rather than replacing particular macros with an 'annotate' attribute and then looking for that. This isn't /really/ any particular win except maybe ever-so-slightly faster module imports (with one fewer attribute being added to each declaration in a mixed-source header). This doesn't remove the SWIFT_CLASS_EXTRA, SWIFT_PROTOCOL_EXTRA, or SWIFT_ENUM_EXTRA macros from PrintAsObjC (note that SWIFT_EXTENSION_EXTRA was never used). They're not exactly needed anymore, but they're not doing any harm if someone else is using them.
70 lines
2.4 KiB
Objective-C
70 lines
2.4 KiB
Objective-C
@import Foundation;
|
|
|
|
#define SWIFT_NAME(X) __attribute__((swift_name(#X)))
|
|
|
|
// 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 NSErrorImports : NSObject
|
|
- (nullable NSObject *)methodAndReturnError:(NSError **)error;
|
|
- (BOOL)methodWithFloat:(float)value error:(NSError **)error;
|
|
- (nullable void *)pointerMethodAndReturnError:(NSError **)error;
|
|
- (nullable SEL)selectorMethodAndReturnError:(NSError **)error;
|
|
- (nullable void (*)(void))functionPointerMethodAndReturnError:(NSError **)error;
|
|
- (nullable void (^)(void))blockMethodAndReturnError:(NSError **)error;
|
|
|
|
- (nullable instancetype)initAndReturnError:(NSError **)error;
|
|
- (nullable instancetype)initWithFloat:(float)value error:(NSError **)error;
|
|
|
|
- (nonnull void *)badPointerMethodAndReturnError:(NSError **)error;
|
|
@end
|
|
|
|
typedef const void *CFTypeRef __attribute__((objc_bridge(id)));
|
|
typedef const struct __attribute__((objc_bridge(id))) __CCItem *CCItemRef;
|