This was discussed a while ago in CDRIVER-691.
I've finally had a chance to try to integrate libbson into a Swift project. Using a fork of libbson@1.6.1 with the module map checked in, I was able to publish a prerelease pod and integrate it into an Objective-C project.
In CocoaPods, all Swift builds, as well as framework-based Objective-C builds, use a module map to collect the interface exposed by a package. This was discussed in CDRIVER-691. Here are a couple links with more information:
- http://blog.cocoapods.org/Pod-Authors-Guide-to-CocoaPods-Frameworks/
- https://clang.llvm.org/docs/Modules.html
By default CocoaPods generates an umbrella header with all of the package's public header files and a module map around that. That doesn't work for libbson, since directly including e.g. bson-compat.h will result in a preprocessor error, "Only <bson.h> can be included directly."
The solution is to ship our own module map, referencing the library's umbrella header, and point CocoaPods to that.
It needs to be checked in. Though it doesn't matter where it is in the repo. I opened this PR: https://github.com/mongodb/libbson/pull/185