Mixing swift & C++ works for visionOS. I am able to pass std:vector, std:vector as arguments to C++ methods successfully, for visionOS targets.
But I suspect there are some gaps/bugs, in visionOS support. Or, maybe some compiler settings/includes is creating some confusion.
Because I can see the problem you mention, in my builds as well.
The line let swiftString = String(cxxString) throws compiler error No exact matches in call to initializer.
The line let cxxString = std.string("This is a C++ string") causes runtime error, silently creating a zero length string.
Post
Replies
Boosts
Views
Activity
The reported issue is still happening on Xcode 15.1 Beta 2 that was published yesterday.
std::string is the equivalent of swift string, and you can copy characters from the std::string.
Refer https://developer.apple.com/documentation/swift/callingapisacrosslanguageboundaries sample xcode project that has many examples of strings being passed back and forth.