Swift for Windows arrives at last, but as an unofficial port

Developers who want to try out Apple's language on Windows can get started with this unofficial port, but an official version is unlikely until Swift 3.0

Swift for Windows arrives at last, but as an unofficial port

An open source effort to port Apple's Swift language to Windows last week released new versions of both source code and binaries.

Swift was originally developed by Apple as a replacement for the Objective-C language used to develop apps for iOS. But after it was released as an open source project, Swift quickly gained traction outside of iOS developer circles -- for example, when IBM created a cloud-hosted development environment for Swift.

Versions of the language already exist for Mac OS X and Linux, but until now no open source port of Apple's Swift code to Windows was available or announced. An official Windows release might still be forthcoming, but in the meantime this version -- which does not appear to be sponsored or developed by anyone from Apple or Microsoft -- claims to provide basic Swift functionality on 64-bit Windows 10.

The Windows port is available on GitHub in its original incarnation, and prebuilt binaries are available using both Microsoft Visual C++ and Cygwin (although the MSVC builds are likely to be more reliable). Another project on Microsoft's CodePlex hub provides a Windows compiler for Swift, with a simple GUI for ease of use.

The most recent build of Swift for Windows requires Visual Studio 2015 and LLVM 3.8.0 to compile Swift source code to binaries. To run the Swift interpreter, you need only the Visual C++ Redistributable for Visual Studio 2015. Compiling and linking with both static and dynamic libraries is supported.

But don't expect much in the way of Windows-specific integration. For instance, if you want to use any of the platform libraries for windowing or UIs, you'll have to build all that yourself. It's possible but requires extensive knowledge of the Win32 API.

Other versions of Swift have been implemented for Windows, but they are not open source. Silver, for instance, is an implementation of Swift intended for creating platform-native applications. It works with the .Net CLR (with Visual Studio integration), the Java and Android virtual machines, and Apple's Cocoa runtime on their respective platforms. But though it is free to use, Silver is not an open source product.

Apple has made it clear that its long-term plans for Swift 3.0 include platform portability, so Swift code written on one platform can be ported with minimal changes. It's likely the first "official" Windows versions of Swift will appear when version 3.0 of the language is released. Still, this unofficial port should allow the Swift-curious on Windows to acquaint themselves with the language without changing platforms.

Copyright © 2016 IDG Communications, Inc.