Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

enter image description here

like image 748
imjaydeep Avatar asked Jan 06 '16 06:01

imjaydeep


People also ask

How do I add a bridging header in Xcode?

To create an Objective-C bridging header file, all you need to do is drag some Objective-C code into your Swift project – Xcode should prompt you with the message "Would you like to configure an Objective-C bridging header?" Click "Creating Bridging Header" and you'll see a file called YourProjectName-Bridging-Header.

What is bridging header in Swift?

Its correct to say, Bridging header allows user to use Objective-C classes/files in their swift code in same project. A Swift bridging header allows you to communicate with your old Objective-C classes from your Swift classes. You will need one if you plan to keep portions of your codebase in Objective-C.

How do you remove a bridging header?

Go to Build Settings of your project, find Objective-C Bridging Header row and remove its contents. This works, and in case anyone ends up with a lot of new errors with NSObject after removing this, check to make sure that you have 'import foundation' in your classes that inherit from NSObject.


1 Answers

  1. First go to project build setting,

  2. Then search Swift in in the search box

  3. After that you will find a Objective C Bridging Header option in Swift Compiler Code Generation Area

  4. Add the bridging header path for this Objective C Bridging Header Option

  5. Path should be Given as

Also you can find below the screen shot for the reference.

Project Name/Project Name Bridging Header.h

like image 68
Sukhdeep Singh Kalra Avatar answered Oct 05 '22 23:10

Sukhdeep Singh Kalra