Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove a bridge header without getting errors?

I added a bridge header to my app the other day because I was trying to add Objective-C files to my Swift project. I was having trouble getting the connection to work(and I also did not know how to implement the Objective-C files), so I decided I wanted to start over again. I deleted the Objective-C files and the Bridge-Header file and now I am getting an error saying:
<unknown>:0: error: bridging header '/Users/CalebKleveter/Documents/Development/iOS/personal/swift/Projects/Dicey/Dicey/Dicey-Bridging-Header.h' does not exist

Xcode Bridge-Header error File tree for an Xcode project

like image 531
Caleb Kleveter Avatar asked Aug 28 '15 15:08

Caleb Kleveter


People also ask

Do I need a bridging header?

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 I manually add a bridging header?

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.

How do you use a bridging header?

Alternatively, you can create a bridging header yourself by choosing File > New > File > [operating system] > Source > Header File. Edit the bridging header to expose your Objective-C code to your Swift code: In your Objective-C bridging header, import every Objective-C header you want to expose to Swift.


1 Answers

Go to Build Settings of your project, find Objective-C Bridging Header row and remove its contents.

enter image description here

like image 70
egor.zhdan Avatar answered Sep 28 '22 03:09

egor.zhdan