Open any Swift view from C++

I've narrowed down my question after many rabbit holes - how can C++ code open any view in Swift. I can call functions in swift from C++ (works great), but not async or main actor (or actor at all) functions. And if I'm not mistaken all views are actors if not main actors? When calling from C+ I think its necessary that the first view be the main actor?

I've implemented the code from the WWDC23 C++ interop video (Zoe's image picker) where I made a view in a struct, and just want to call it and let the view do the work.

The compiler immediately gives me 'cannot expose main actors to C++'. If I'm not mistaken, doesn't this block the opening of any kind of swift view from C++? Hopefully I'm missing something obvious, which is likely :)

In Zoe's code was his entry point into the program still Swift and not actually C++ app?

Thanks!

Thanks!

You’ve got a few threads going here, all covering roughly the same topic. I’m gonna respond on this one and we can come back here if there’s need.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Open any Swift view from C++
 
 
Q