当我创建一个Swift类时,Xcode会将这个Swift类添加到swift.h中。但是,仍然没有在swift.h中添加任何东西。
普通swift.h:
SWIFT_CLASS("_TtC8facebook19swiftViewController")
@interface swiftViewController : UIViewController
- (void)viewDidLoad;
- (void)didReceiveMemoryWarning;
- (SWIFT_NULLABILITY(nonnull) instancetype)initWithNibName:(NSString * __nullable)nibNameOrNil bundle:(NSBundle * __nullable)nibBundleOrNil OBJC_DESIGNATED_INITIALIZER;
- (SWIFT_NULLABILITY(nonnull) instancetype)initWithCoder:(NSCoder * __nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
然而,前面提到的Swift类不包括在我的swift.h中:
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
#pragma clang diagnostic pop
答案 0 :(得分:1)
如果Swift类声明为@objc
,或者直接或间接地从NSObject
派生,则Swift类只会添加到-Swift.h文件中。