The team working on the Swift programming language has said its goals for the upcoming version 5.3 will include "adding support for Windows and additional Linux distributions".
Swift is a programming language developed by Apple and first released in September 2014. It won immediate popularity as an alternative to Objective-C that is both safer and more productive to use. Apple open-sourced Swift in December 2015, sparking immediate interest in porting it for other platforms. Currently only Apple platforms (MacOS, iOS, iPadOS, tvOS, watchOS) and Linux are officially supported, though Apple has said there are "community members actively working to port to even more platforms."
IBM sponsored the Kitura framework for server-side swift, but withdrew much of its support in December 2019 thanks to disappointing take-up. That said, there is still an official Swift Server Work Group and projects include Swift NIO (an event-driven network framework). Vapor is a web development framework that runs on macOS and Ubuntu.
IBM tailors Swift relationship after 'review of open source priorities'READ MORE
What about Windows, though? There have been several efforts to support Swift development. RemObjects has a proprietary Swift compiler which targets numerous platforms (.NET, Android, Java, Windows, Linux and WebAssembly), but compatibility is not perfect.
There is an open source Swift for Windows but it seems moribund. You can use Windows Subsystem for Linux (WSL) to run the Swift compiler, though the REPL (Read Eval Print Loop), an interactive command-line, does not work in WSL 1.0. Running the Swift toolchain in a Docker container is also a possible solution for developers wishing to code on Windows.
The good news for would-be Windows Swift developers is that an official route to native Swift for Windows is well advanced. The project is called swift-build rather than swift-windows, because it covers Linux and Docker as well as native Windows. The minimum Windows 10 version is 10.0.17763.0 (October 2018 update). Developing and building for Windows is a little fiddly but no doubt this will be smoother when there is a fully supported release.
The key announcement came back in January when "expand the number of platforms where Swift is available and supported" was stated as a goal for Swift 6, and Saleem Abdulrasool, described as "the primary instigator behind the port of Swift to Windows", was added to the core team. Now, in the announcement of the process for Swift 5.3, "adding support for Windows and additional Linux distributions" is specifically noted.
A better supported Swift on Windows and Linux will help adoption, but this will be primarily for server-side or non-visual code. Windows Swift for Tensorflow, used for working with ML models, is a good use case alongside projects like Vapor.
Here we GUI
What about GUI applications though? This is a problem because SwiftUI is tied to Apple operating systems. There will be solutions, but unfortunately the idea of taking your Swift application for macOS and/or iOS and recompiling it for Windows will not fly.
Another issue is whether the open source Swift community can build enough momentum for cross-platform Swift to achieve production-quality releases. Apple made Swift open source, but has little incentive to invest in platforms other than its own. Swift was invented in order to make developers more productive coding for Apple platforms. Progress in cross-platform Swift has been slow.
Proceed with caution therefore, but Swift on Windows will still be a milestone for a language which is well liked. Swift won praise recently from an unlikely source: Microsoft's Miguel de Icaza, who has worked for years on taking C# cross-platform. "There is plenty to love about Swift technically, and I will not enumerate all of those features, other people have done that. But I want to point out a few interesting bits that I had missed because I was not a practitioner of the language, and was more of an armchair observer of the language," he said last week. Perhaps cross-platform Swift will encourage others to take a look. ®
Sponsored: Webcast: Ransomware has gone nuclear