I am building a tool that enables the user to write, auto-compile and interact with SwiftUI code (think something like a mini Xcode Canvas). Which so far works really well.
The app is not sandboxed since it uses tools like swiftc and sourcekit-lsp.
The obvious problem here is that since the 'Preview' part of the app is driven by arbitrary code a crash/hang there would lead to a termination of the whole app.
I understand that there are some private apis like NSRemoteView or CALayerHost but I would like to avoid them if I can.
From what I see reading other similar solutions IOSurface sharing + event forwarding might be the best solution.
So my question is: Is there a proper or recommended way to achieve this? Meaning having a fully interactive SwiftUI view presented in my host app but running on a separate process?
Any pointers to the right direction or examples or whatever could help me with this would be greatly appreciated.