Charts: MyProject-Swift.h header not found when embedding framework into ObjectiveC project
I tried following the usage guidelines on the README for ObjectiveC projects several times and it never creates the “-Swift.h” header file so I can import.
I do as follows:
1 - Drag the Charts.xcodeproj to my project

(Cmd + B -> Build Successful)
2 - Go to your target’s settings, hit the “+” under the “Embedded Binaries” section, and select the Charts.framework

(Cmd + B -> Build Successful) This should do step 3 of the Guide
(Since it’s a ObjectiveC project, I jump to step 5)
5 - Under “Build Options”, mark “Embedded Content Contains Swift Code”

(Cmd + B -> Build Successful) After this build I think my “-Swift.h” header file should be already generated, so we should be good, right?!
Alright, so by now I should be able to do a simple #import "NewChartDemo-Swift.h", but then:

Am I missing something? I wasn’t able to achieve the expected results in any of my several tries, looked up StackOverflow for other people having trouble importing Swift Frameworks into ObjectiveC projects and none of the work arounds work for me.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 21 (3 by maintainers)
Sometimes the -Swift.h header is not created until you manually create a Swift file in your project. And sometimes you just don’t know how to name it correctly… In your case it is definitely
import "NewChartDemo-Swift.h", so I’m guessing that Xcode wants you to manually create a .swift file for it to start creating the -Swift.h file.So here’s what you should do: