Hello,
Im developing an app entirely with C++, and I need to call various swift functions because it requires the Swift library.
Ive seen several posts on forums about C++ callbacks and honestly I dont understand how its done exactly. I get the general idea but I am not able to understand it and make it work. I feel like people throw vague ideas and weird function names and everything gets confusing.
Could anyone give me the smallest example that works please ?
Just to make sure you know what I mean, here is an example of what I want to do, but you dont have to generate the code exactly for this, I want an example that I can understand please, but the swift code has to depend on a swift library. I dont want to simply call a swift function that returns x*2 ...
{1} notif.swift file : coded in swift language
include <UserNotifications/UserNotifications.h>
function A that show notification in swift code.
{2} mainwindow.cpp file : coded in C++ language
import notif.swift ??
button connected to slot/function mybuttonclicked.
MainWindow::mybuttonclicked(){
std::string my_result = call function A_from_swift_file(argument_1);
}
--The end ---
I wrote the notif.swift with '?' because I dont know how you include the swift file from your cpp code and I could not find that anywhere. Maybe it is obvious, but I would really appreciate getting some help on this, Thank you everyone