Swift to Objective-C header not created in Xcode 6

Solution 1:

Now it works.

  1. Project must have a Product Module Name that does not include spaces.
  2. Defines Module must be set to Yes in Build Settings, under Packaging.

Finally works. Thanks to everyone for the help :-)

Solution 2:

I had a similar problem and found that you can only add

#import "ProductModuleName-Swift.h"

to obj-c .m files, not .h files for the umbrella header to be found

Solution 3:

I found that I had to fix all build errors before it would generate the file.

The problem for me was that it was a chicken/egg problem, in that I didn't see any build errors until I'd actually commented out the #import statement:

//#import "ProductModuleName-Swift.h"

which revealed a bunch of other errors in my Swift code.

Once I fixed these new errors and got the source building successfully, I uncommented out the #import and bingo! The header was created and importing correctly :)

Solution 4:

If you're like me you've probably got the header name wrong. After bashing my head for a while I looked for the file in DerivedData and sure enough it's there. On my setup (using the standard derived data folder, I believe):

cd ~/Library/Developer/Xcode/DerivedData
find * -iname '*Swift.h'

Will find it. If nothing in that folder matches then Xcode is not generating it.

I'm using Xcode Version 6.2 (6C86e)