I realize that requires a MacOS computer, which costs money, but the “free” in free software principles is about the freedom to share the code, not the price of the code. Free software is allowed to be sold.
Increasingly, it is also possible to run Swift code on Linux without Xcode or MacOS (recognizing the GUI would need to be rewritten).