Hello Apple Developer Forum community,
I'm exploring the possibilities of mixing Swift and C++ for a project that involves VisionOS. The Swift official documentation on Mixing Swift and C++ mentions that C++ interoperability is supported for development and deployment on all platforms that Swift supports.
I would like to confirm whether this support extends to VisionOS. Does VisionOS allow the use of C++ APIs, and how can various C++ APIs be effectively imported and used in Swift for VisionOS development?
If anyone has experience or insights related to mixing Swift and C++ specifically for VisionOS, I would greatly appreciate your guidance and advice.
Thank you for your assistance.
Best regards,
Mixing swift & C++ works for visionOS. I am able to pass std:vector<int>, std:vector<float> 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.