Declare a Swift function with completion (or async) to be called from C++

Hi. Almost everything is detailed in the topic.

Basically trying to write in Swift func myFunction(completion: UnsafeRawPointer?) that will be called from C++.

How do you declare the C++ callback, and how do you cast it in Swift ?
Maybe it's wrong in the Swift declaration already, open to better ways.

Thanks!

Nevermind, I found the solution. Ask if interested.

Internet rules say that when you find the answer to your own question that you must share the full answer :slight_smile:

9 Likes

…?