Bridging Objective-C into Swift Project - ios

I'm trying to put a bridging header file into my Swift project so I can use the Venmo SDK. I've placed the header file where I believe it should go and have added it to the Swift Complier - Code Generation section under build settings.
The bridging header is titled BridgingHeader.h and is directly under the project subsection (would post photo but I don't have enough reputation). It's in the same location as this link:
Under the swift compiler - code generation my path to the bridging header is BridgingHeader.h. Initially I tried to reference the file from the root directory but I still had an error saying error:
bridging header '/Users/j9/Desktop/uSell-swift/BridgingHeader.h' does not exist

Apparently, the compiler is looking for .../BridgingHeader.h, while the actual name is LearnSwift-Bridging-Header.h.
By the way, you can avoid these annoyances by adding an ObjC class File->New->Source->Objective C file... It will create and configure the header for you.

Related

"Objective-C Bridging Header" entry in Build Settings does not appear in Xcode 8.3

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

using Swift code in Objective-C project by creating bridge files in iOS

while merging swift code to objective c existing projective c project am not able to import the header files into bridge file and also i get some syntax errors in the merged swift classes am getting following errors what has showed in image
Do you create Bridging Header from these steps.
Step1. Create Bridging Header file
Step 2. After creating bridging header goto Project Settings and search Objective-C bridging header and add bridging header file path.
By following these step you have successfully added bridging header file. Next you have to import framework, you like to add.
If you still found any issue then show us the error.

objective-c Bridging header not found in swift compiler-code generation

I am doing an ios app in swift 3. And I want to add ARKitwhich is available in objective-c. I dragged all objective-c files into my project then it asked to create bridging header. So I let it to create. And I imported all objective-c.h files inside that like this.
But when I try to build its showing 22 number of issues like UIViewcannot identify etc..
Then I tried to add the bridging headerpath to build settings under swift compiler - code generation. But I dont see objective-c Bridging headersection under that.
Please help me. What can I do to add these objective-c files into my swift 3 project successfully.
Thanks
The Objective-C bridging header setting can be found under Swift Compiler - General under Build Settings.
But I like to add the bridging header by having Xcode generate it for me. I add a junk Objective-C class by File > New > File... and it will ask me if I want to add a bridging header to my project.
If you do that, you'll only need to move whatever you have in your bridging header now to that one and delete the header you have now. The header will be set properly in the project's settings.
Make sure your build setting is selected as "All" and "Combined" look at below link
Swift Compiler - General is missing in Xcode 9.1

How to find path of Bridging-Header.h - Swift, Xcode

Here I'm attaching a screenshot of created header file
I have created a new header file in xcode and named it as (projectname)-Bridging-Header.h. But I am not able to find the path and make it work. How to find the path of the file?
First go to project build setting,
Then search Swift in in the search box
After that you will find a Objective C Bridging Header option in Swift Compiler Code Generation Area
Add the bridging header path for this Objective C Bridging Header Option
Path should be Given as
Also you can find below the screen shot for the reference.

Add Bridging-Header inside .framework

I want to know if it is possible to add a Bridging-Header.h inside a .framework.
My goal is to have my framework compliance for swift.
I don't have find solution to add bridging header file inside my framework but have find other solution. That is to explain how to create a bridging header file without import Objective-C file.
For people who want to do this be careful when you indicate the path in Objective-C Bridging Header under Swift Compiler - Code Generation to your bridging header file. It is important to to this in your Target build setting and not in your project build setting else you will be have an error.

Resources