How do I use C++ written code in Swift via Interoperability

48 Views Asked by At

I'm using this guides (first one I described below step by step) https://github.com/apple/swift/blob/main/docs/CppInteroperability/GettingStartedWithC%2B%2BInterop.md

https://developer.apple.com/videos/play/wwdc2023/10172/

https://www.swift.org/documentation/cxx-interop/project-build-setup/#mixing-swift-and-c-using-xcode

And I can't figure out how to properly set my project to use c++ functions, classes with methods in swift. Can someone please explain it to me?

So, I create Xcode project (Comman Line Tool), make new target (library), select (STL and dynamic) and I get new folder with 3 files. After that I create modulemap and do all necessary build settings.

Swift guide says:

This should now allow your to import your C++ Module into any .swift file.

But when I write import CxxTest it throws:

No such module 'CxxTest'

It doesn't matter if I check C++/Objective-C++ in project settings (as it was in 2nd guide)

0

There are 0 best solutions below