I can use Bundle on macOS to load a framework at runtime, and that works reasonably well even with Swift (given the principal class is @objc). Can I do something similar under Linux?
It is definitely possible to load dylib in linux using swift, I made a little example app couple months ago to document a bug in SPM. You can see implementation here:
there are two related projects, one that defines plugin's interface and other that show how actual plugin is implemented:
Not sure if this is exactly what you need, but it is possible to load your own dylib and interface with it
Ok the problem here is that only C functions can be called, and Swift libraries are not really supported.
I guess my question is if there is any kind of story or roadmap on how and when this is planned to be properly supported (not just on Linux). I mean even on macOS the requirement to only use Obj-C protocols leaves a lot to be desired.
I think we can start with a JIRA, for the Linux bit.
This may depend on ABI and module stability; otherwise loading some bit of Swift code that was not compiled with the rest of your code may result in some strange behavior.