<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi, Rien. Libraries don’t support bridging headers because the client of the library has to be able to <i class="">import</i> the header, and arbitrary bridging headers may conflict. (This is actually the primary purpose of modules for Objective-C: to declare a group of headers that are self-contained—besides what other modules they import—and can therefore be imported earlier or later without difficulty.) The compiler will mildly try to stop you from doing this if it can figure out you’re building a library, but it’s a bad idea no matter what. Even if everything appears to compile fine, it’s likely you’ll get inscrutable errors when trying te debug anything that uses your library.</div><div class=""><br class=""></div><div class="">The particular difference between Xcode-created frameworks and SwiftPM-generated libraries is that Xcode frameworks are set up to be mixed-source, using the Objective-C public umbrella header in place of a bridging header. SwiftPM doesn’t support mixed-source targets. (Since I don’t work on SwiftPM myself I don’t know if there are any public plans to do so.)</div><div class=""><br class=""></div><div class="">The recommended solution is to group your Objective-C headers into modules (usually just frameworks) and import them that way, rather than to jam them in via a bridging header.</div><div class=""><br class=""></div><div class="">Sorry for the trouble,</div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 20, 2017, at 08:49, Rien via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I noticed something strange about Xcode and SPM concerning the capability to generate Libraries.<br class=""><br class="">When I try to create a Library in Xcode and then want to add an Objective-C bridging header, that is denied. It claims that bridging is not supported for Libraries.<br class=""><br class="">When I create an Xcode project through the SPM (with “swift package generate-xcodeproj”) then I can use bridging headers, even though the end result is a library.<br class=""><br class="">Question: Is this a viable work around? or are there hidden dangers that might not be immediately apparent?<br class=""><br class="">As a side note: SPM complains about multiple languages and currently only supports pure Swift modules.<br class="">This creates the strange situation that I now use SPM to create an xcode project and then use Xcode to create bridged mixed language libraries.<br class=""><br class="">Regards,<br class="">Rien<br class=""><br class="">Site: <a href="http://balancingrock.nl" class="">http://balancingrock.nl</a><br class="">Blog: <a href="http://swiftrien.blogspot.com" class="">http://swiftrien.blogspot.com</a><br class="">Github: <a href="http://github.com/Swiftrien" class="">http://github.com/Swiftrien</a><br class="">Project: <a href="http://swiftfire.nl" class="">http://swiftfire.nl</a><br class=""><br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></div></blockquote></div><br class=""></body></html>