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 :)
相关问题
- Xcode successfully builds but fails to run macOS a
- How to give an imageView in swift3.0.1 shadow at t
- Swift 3: How to reverse a transparent Navigation B
- iOS Share Extension flow
- Facebook login in Swift 3
相关文章
- Swift Change the tableviewcell border color accord
- Cocoapods : target has transitive dependencies tha
- Error Domain=kAFAssistantErrorDomain Code=209 “(nu
- UIImagePickerController delegate not called Swift
- Simple service in Swift, persists, foreground only
- xcode 8 Debugger 'Could not resolve type'
- iOS swift NSMutableData has no member appendString
- Conforming to Hashable protocol?
Objective C Header file creation steps
File -> New -> File -> Header File
Name your Header file like this yourAppName-Bridging-Header
Now click on your Project -> Build Settings
Change from Basic to All
Search Bridging
You will get the search result as shown in the below image
after Adding
In that double click the right of Objective-C Bridging Header and enter as follows
eg, yourAppName/yourAppName-Bridging-Header.h
You need to import as follows
Happy Coding :)
Note:
The header file should be directly inside project, ie. it should not be created inside any subfolder
Try clearing or renaming your DerivedData folder, then restart Xcode8. There must be some cached Xcode7 files in there remaining.
Worked for me
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. :)
In the case of multiple targets, make sure the swift classes are members of that target, or else the file will not be generated.
Xcode 8.3