Swift language tools now available for Windows

Swift language tools now available for Windows
Swift language tools now available for Windows (Image credit: Joseph Keller / Windows Central)

Swift language tools now available for Windows

Source: Joseph Keller / iMore (Image credit: Source: Joseph Keller / iMore)

What you need to know

  • Swift is seeing its initial release on Windows.
  • Developers can now download Swift toolchain images for Windows 10.
  • Developer Readdle has been experimenting with bringing Swift to Windows for more than a year.

The Swift Project, the ongoing open-source efforts to develop the Swift programming language, has announced that an initial release of Swift is now available for Windows 10. What this means is that the tools, like the compiler and core libraries, are all available for developers right now.

From the Swift Project:

Porting Swift to Windows is not about simply porting the compiler, but rather ensuring that the full ecosystem is available on the platform. This includes the compiler, the standard library, and the core libraries (dispatch, Foundation, XCTest). These libraries are part of what enables developers to write powerful applications with ease and without having to worry about many of the details of the underlying system. There are many technical details in the story of bringing Swift to a usable state on Windows, and if you are interested in them, I would recommend checking out my talk on the topic from the LLVM Developer Conference.With these core libraries and the flexible interoperability of Swift with C, it is possible to develop applications on Windows purely in Swift while taking advantage of the existing corpus of libraries on the Windows platforms.

The blog post goes on to demonstrate a simple calculator app that was written entirely in Swift. It was created with the Swift toolchain for Windows, as well as an installation of Visual Studio 2019.

An interesting wrinkle to the story is the involvement of Readdle, a long-time Mac and iOS developer. The company has been experimenting with Swift on Windows for more than a year as part of its efforts to bring its Spark email client to the platform:

Despite some functionality being unready as of yet, Swift on Windows turned out to be fully satisfying our needs. In fact, some third party C/C++ dependencies gave us more headaches than Swift did itself. All business logic of Spark is located in a separate Core module. A pack of modules, actually, but we refer to them as Core. This allows us to use any UI framework on the target platform: AppKit on macOS, UIKit on iOS, native UI Toolkit on Android. So, basically, we had to port Spark Core on Windows. After all initial concepts were proved, it was mostly routine day-to-day work to bring it alive on Windows.

Readdle's post dives more deeply into some of the different tools its used in its effort to build with Swift on Windows, including a number of the modules available, and covers topics like the build system and Swift's interactions with Node.js.

Swift was originally announced by Apple at WWDC 2014 as a modern language that would eventually take the place of Objective-C as the primary language for building applications for Apple's platforms. Apple has since open-sourced Swift, and the open-source project has made tools for the language available for Ubuntu, CentOS, and Amazon Linux distributions, in addition to macOS and, now, Windows.

You can download the Swift toolchain for Windows from the Swift Project website.

Joseph Keller