I am working on an iOS project developed using Objective-C. I need to integrate some Swift files in it. So, did following:
- Added a new Swift file named "temp", so that
MyProject-Bridging-Header.h
is added by my Xcode IDE (Version 9.1). - Added the Swift files, which I want to use, to the project.
- Changed target setting
Defines Module
to YES. - Similarly,
Product Module Name
is set to "MyProject". - I can see the
MyProject-swift.h
a file name for the setting "Objective-C Generated Interface Header Name". - Added import statement for
MyProject-swift.h
in one of my Objective-C .m files and was able to build the project successfully. - I checked in Finder that
MyProject-swift.h
was created. - Ensured the @obj prefix in the Swift classes declaration.
Still, when I try to use any of the Swift classes, then I get compile time error "User of undeclared identifier".
What can be the reason for the issue? Am I missing something?
[update Xcode 14]
By default the PRODUCT_MODULE_NAME
is set to XXX-Swift.h
< Swift with an S capital.