See:
https://forums.swift.org/t/c-interoperability-in-swift-5-9/
Maybe scripting TeXmacs using Swift might be feasible?