Reputation: 6604
I have a custom Framework that has a bunch of Objective-C Classes. Within the Framework, I'd like to add more classes using Swift. However, when trying to expose the Swift classes to the Objective-C code using: MyProduct-Swift.h
, it comes up as "MyProduct-Swift.h
file not found".
I've tried this in a single view template and it works fine. Is it not possible to import Swift within a framework?
I've also verified that I have set the Defines Module setting and the Module Name. I've tried it with and without these settings.
Upvotes: 8
Views: 5108
Reputation: 2245
I found some additional steps to make it all work. In addition to setting 'Define Module' to YES and 'Product Module Name' (usually these are set correct by default if you create new touch Framework in Xcode 6) you also need:
#import <ProjectName/ModuleName-Swift.h>
Upvotes: 14
Reputation: 419
Ok, I found what the problem is.
Make sure that in Build Settings - > Packaging you have Define Module set to YES and Product Module Name is set as well. Then in the storyboard file the name for the Module should be the same and match what you have in your Build Settings. Then in your Obj-C file write include "-Swift.h"
That did the trick for me.
Upvotes: 4