Hope you all had a good Christmas (if you celebrate).
I have written a chunk of Swift code that takes an audio file input, processes the audio and then saves out a new file. It uses AVAudioEngine with a few effect nodes. Obviously not something I can do within Xojo, so I’ve had to resort to Swift.
I need to call this Swift code from within a Xojo app, but am unsure of the best way to do it. My thinking is:
Create a Xojo plugin. Can Swift be used for Xojo plugins, or does it have to be Objective C?
Compile it as a library of some sort. No idea how to do this or how to call it from a Xojo app!
Create a windowless helper app that I can run from my Xojo app. If I do this, should I compile it as a CLI or can I use a Universal Binary (so I can include x86 and ARM M1 in the same app - this would be handy). The helper wouldn’t need to communicate back to the main app, it just carries out its work and closes. So no complex communication required, just run and forget.
If I use a helper app, what mountain of issues can I expect if my Xojo app is sandboxed or hardened / notarised? I assume I can’t just use FolderItem.Open to execute the helper if the app is sandboxed and instead have to use some magic to pass on permissions etc.?
I’ve called a Unix CLI from a sandboxed Xojo app before and remember it being a nightmare (and seems to not work on M1 Macs). Will my helper app inherit permissions from the main Xojo app (in terms of file access / container folders etc. I’d need it to have the same working folder). I use Sam’s brilliant AppWrapper, so hopefully any helper app I include in the bundle would be signed / sandboxed properly.
If the worst comes to the worst I can always copy the file that needs processing into the apps data folder, so providing the helper app inherits the permissions for my app’s container folders, all should be well.
Any info or pointers gratefully received before I go down the wrong path. Unless it’s super easy to create a plugin, I’m leaning towards option 3 - that’s if I can work out how to run apps from within a sandboxed Xojo app.