Many parts of the Swift toolchain are already open source [1], there is a Windows and even a WASM port [2].
The caveats are:
- Xcode indeed isn’t, but you can use sourcekit-lsp for Swift development with some compromises. The experience has really improved the last few months thanks to the Swift Server Work Group [3].
- Apple platforms have their own Foundation implementation and the open-source one is incomplete.