2

Assume my project is called "Project". My actual project name does not have any spaces either, so that's not an issue.

I'm aware that to use a Swift file in Obj-C, you can add Project-Swift.h to the .m file.

However, I get a 'Project-Swift.h' file note found error.

I've checked my Build Settings and in both the Target and the Project made sure the Objective-C Generated Interface Header Name on both of those is explicitly Project-Swift.h.

Additionally, again, on both the Target and the Project Build Settings I switched "Defines Module" to Yes.

I've also tried completely deleting the objective c file that I'm trying to make this import statement on, then creating a new one and copy and pasting the code in in case it was some issue with the project.pbxproj file.

Even though I don't need to use Obj-C code in Swift, I tried creating a `Project-Bridging-Header.h" and made sure it's referenced correctly in the Swift Compile Build Settings for both the target and the project.

So to follow up on that I don't have any circular references or anything that would require a forward declaration.

All of this seems to be in vain.

What am I missing?

gadu
  • 1,816
  • 1
  • 17
  • 31

1 Answers1

-2

Add an import to the location of the .h file in objective-c class.

Just import in .h file:

#import <Project-Swift.h>
Blue
  • 22,608
  • 7
  • 62
  • 92
suhas
  • 191
  • 1
  • 8
  • 1
    Take a moment to read through the [editing help](//stackoverflow.com/editing-help) in the help center. Formatting on Stack Overflow is different than other sites. – Blue Jan 30 '18 at 13:42