简体   繁体   中英

SWIFT_OBJC_BRIDGING_HEADER in Swift Package Manager

I am trying to utilize an Objective-C framework inside the Swift package. For this, I would need to import the headers something like

#import<Framework/header.h>

Traditionally this can be achieved via bridging header. How can I set the bridging header via package manager settings?

也在为此寻找解决方案。 Swift PM 明确禁用此功能

\/\/ We currently deliberately do not support Swift ObjC interface headers. settings[.SWIFT_INSTALL_OBJC_HEADER] = "NO"<\/code>

https:\/\/github.com\/apple\/swift-package-manager\/blob\/main\/Sources\/XCBuildSupport\/PIFBuilder.swift<\/a>

真的很烦!!!

"

This is bit tricky. You cannot import Objective-C framework's header files directly into SPM as you cannot write import statement such that #import<Framework\/header.h><\/strong><\/em>

It can be done with module map as referred here<\/a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM