神刀安全网

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 being released as an open source project , Swift quickly gained traction  outside of iOS developer circles , as 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 pre-built 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 to make it easier to 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 just 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.

Don’t expect much in the way of Windows-specific integration, though. 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 to do but requires knowing the Win32 API intimately.

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 leverages the .Net CLR (with Visual Studio integration), the Java and Android virtual machines, and Apple’s Cocoa runtime on their respective platforms. But Silver, although it is free to use, 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 get acquainted with the language without having to change platforms.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Swift for Windows arrives at last, but as an unofficial port

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址