Can I mix with C++ in swift project

Since Apple released the Swift, I started to write Swift code. Very cool, but unfortunately when I want to use ffmpeg or openCV , I must do like that:
..Bridging-Header.h : you expose C , Objective-C and Objective-C++ to Swift using this bridge
I truly hope in someday Apple can add this features into Swift and then I can say goodbye to Objective-C completely.
If I can use Swift to invoke the C++ , that's cool.
So do you plan to make it happen in someday?

It already partially exists in the current release. I believe the TensorFlow team as been contributing aspects that are low hanging fruit. None of it is officially supported yet. A C++ interop manifesto was released. I would stick to a C wrapper for now. Many C++ libraries already provide this layer since this is needed for bindings to almost all other languages.

It looks like OpenCV discontinued the C API. You’re stuck writing your own wrapper or more likely just writing the minimal code for your application in C for now. Alternatively you could call it through Swifts built-in Python interop using the Python wrapper for OpenCV. Swift can use your systems Python or PythonKit. Details are on the TensorFlow for Swift website. https://www.tensorflow.org/swift/tutorials/python_interoperability

1 Like
Terms of Service

Privacy Policy

Cookie Policy