I have a project that was started in Objective-C, and I am trying to import some Swift code into the same class files that I have previously written Objective-C in.
I have consulted the Apple docs on using Swift and Objective-C in the same project, as well as SO question like this, but still no avail: I continue to get the file not found error after putting in #import "NewTestApp-Swift.h"
(NewTestApp
is the name of the Product and module).
Here is what I have done so far:
Define Modules
, selected YES
for the app.I have tried using #import "NewTestApp-Swift.h"
inside ViewController.m
, ViewController.h
and AppDelegate.m
but none of them has worked.
What else am I doing incorrectly? Thanks for your help.
Screenshot of settings:
Errors that I am presently encountering:
I was running into the same issue and couldn't get my project to import Swift into Objective-C classes. Using Xcode 6, (should work for Xcode 6+) and was able to do it in this way:
@class MySwiftClass;
#import "ProductModuleName-Swift.h"
Link to the Apple documentation about it.