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.
Topic:
Programming Languages
SubTopic:
Swift
Tags: