I need to add some Objective-C
files of a library to my project, and I created the MyProject-Bridging-Header.h
file myself. But now I'm not able to set its path because in the project's Build Settings I don't find the Objective-C Bridging Header
entry.
Is somebody else experiencing the same? How could I solve this?
In Build Setting choose "all" instead of "basic"
Usually when you had an Objective-C/Swift project and have added new Swift/Objective-C class file Xcode asks whether you want to create Bridging Header or not.
If the option to create Bridging Header automatically f.e. has been denied there`s still an option to create it manually.
Since you have already created YourProject-Bridging-Header.h
header file all you need to set the path to it in your project Build Settings.
To set the path to your Bridging Header file you need to navigate to your project Build Setting where look for Swift Compiler – General section like the Hoa mentioned above.
It is located between "Swift Compiler - Custom Flags" and "Swift Compiler - Search Paths" ones at the same page with all "Swift Compiler" sections.
There you can see Objective-C Bridging Header which you can click and set the path to your YourProject-Bridging-Header.h
Bridging Header file like YourProjectName/YourProject-Bridging-Header.h
.
Now you can open up your YourProject-Bridging-Header.h
and put Objective-C/Swift classes using the #import
statement into it.
Thanks to http://www.learnswiftonline.com/getting-started/adding-swift-bridging-header/
And Objective-C Bridging Header not getting created with Xcode 8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With