hanorz
hanorz

Reputation: 21

swift.h Cannot Find Swift Class

When I created a Swift class, Xcode will add this Swift class into swift.h. But nothing is added in swift.h, still.

Normal 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;

The aforementioned Swift class is, however, not in included my swift.h:

#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
#pragma clang diagnostic pop

Upvotes: 1

Views: 143

Answers (1)

zpasternack
zpasternack

Reputation: 17898

Swift classes only get added to the -Swift.h file if they're declared with @objc, or are derived (directly or indirectly) from NSObject.

Upvotes: 1

Related Questions