Running Swift Code from Juce Project?

Hi all,

I’ve written some some code in Swift using the Accessibility framework and want to use this in one of my Juce projects. Googling around I could only find advice how to use c++ code in Swift projects but not the other way around.

In my case, I simply want to call a swift function from c++ and returning a simple boolean.


You can’t call Swift from C++ (that I’m aware of) but you can from Objective-C++. So instead of adding a .cpp file to your project, and a .mm

Then you’ll need to follow the steps here:

If you keep your header pure C++ then normal C++ can use your function / class. Keep all the Objective-C++ that interfaces to the Swift in the .mm file.

You will need to be outside of what Projucer can do, so you’ll need to maintain your project yourself.

Thanks G-Mon,

I‘ll have a look at this.


Hi, see Call swift code from objc code in … | Apple Developer Forums re. calling Swift from CPP.