I am trying to add objective-c libraries to my Swift 3 project (Xcode 8 IDE). But objective c interface header is not getting generated automatically. I tried to add bridging header manually but showing linking error saying bridging header .h is not found. Any help would be appreciated :)
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.
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.
Add any Objective-C file to your Swift project by choosing File -> New -> New File -> Objective-C File. Upon saving, Xcode will ask if you want to add a bridging header. Choose 'Yes'.
Here the solution for the issue.
Open finder and drag and drop your bridging header file to the popup. Now it will create an absolute path for bridging header. To make relating path, you can give the path as $(PROJECT_DIR)/$(PROJECT_NAME)/$(PROJECT_NAME)-Bridging-Header.h
Click outside for the value get saved. Done!! Now you can import your Objective-C libraries (eg. #import "SVProgressHUD.h") to bridging file and start using it in your swift project.
Hope this would be helpful to someone. :)
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