Header Search Path for C++

I have a C++ API I would love to use with Swift. I started with an existing C++ library project I had in Xcode, added Swift sources and a bridging header. In the bridging header I imported the headers for the C++ APIs. Since the project already had all the header search paths setup, all is working fine.

From Swift, I can successfully access the C++ classes, but run quickly into an issue.

Their implementation of a C++ smart (reference counted) pointer class uses functionality from std::iterator not available in the macOS SDK (macOSSDK -> include/c++/v1/iterator). In the project, they add the following to the header search path (HEADER_SEARCH_PATHS): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include

The iterator header file in this location has the addtions they utilize (notably iterable_type).

Try as I might, I can't seem to get the swift objective c++ interop to use the HEADER_SEARCH_PATHS value or otherwise get it compile. The result is the same C++ class can be used in pure C++ source code, but not from swift in the same project.

Hope this makes sense. I am brand new to C++ interop with Swift but hope to find a solution. Thanks.

From my experience it's easier to use an intermediate Obj-C++ wrapper: it can used everything from C++ and it can expose what's needed to swift in the form acceptable by swift.