You need to import ProductName-Swift.h
. Note that it’s the product name – the other answers make the mistake of using the class name.
This single file is an autogenerated header that defines Objective-C interfaces for all Swift classes in your project that are either annotated with @objc
or inherit from NSObject
.
Considerations:
-
If your product name contains spaces, replace them with underscores (e.g.
My Project
becomesMy_Project-Swift.h
) -
If your target is a framework, you need to import
<ProductName/ProductName-Swift.h>
-
Make sure your Swift file is member of the target