I have a project with mixed Swift and Objective-C in Xcode 8 that uses the generated \"ModuleName-Swift.h\" header file to import swift into Objective-c classes, but the pre
If
note that each target uses (and should use) a different filename for the Objective-C Generated Interface Header Name.
This means you cannot import the generated header file in your Objective-C .h files, because they won't be found in the test target:
Instead, you should move these #import statements into your Objective-C .m (implementation files), where they'll build successfully.
If you need to refer to Swift classes in a .h file, use the @class directive, e.g.:
//
// ViewController.h
// import-example
//
#import
@class SomeSwiftClass;
@interface ViewController : UIViewController
- (NSString *) titleFromGenerator:(SomeSwiftClass *)generator;
@end