Swift start to support windows
Swift has achieved initial support for Windows. Developers can now download Swift toolchain images for Windows
In the past year, the Swift team and swift.org developers have worked together to port Swift to Windows. Currently, Swift has achieved initial support for Windows. Developers can now download Swift toolchain images for Windows. These images include The development components needed to build and run Swift code on Windows. Based on this, the developer finally achieved the goal of Swift development on Windows.
Saleem Abdulrasool, a member of the Swift Core team, pointed out that porting Swift to Windows is not just a simple porting of the compiler, but also to ensure that the complete Swift ecosystem can be used on the Windows platform. In addition to the compiler, standard function libraries and core function libraries (Foundation, XCTest, scheduling, etc.) must be transplanted to allow developers to write powerful applications simply and conveniently without worrying about the details of the underlying system. With these function libraries, coupled with the flexible interoperability of Swift and C, developers can fully use Swift to develop applications in Windows, and can also use the existing function libraries of the Windows platform.
Saleem once shared the technical details of the porting process at the LLVM Developer Conference. Click here for details .
The Swift team showed a calculator demo written entirely in Swift:
It also means that its code can be seamlessly switched between application code written in Swift and system libraries. This calculator demo is built using the following projects:
Swift toolchain on Windows
Visual Studio 2019 and CMake, Ninja and Windows SDK
Although this demo uses CMake to build, Swift Package Manager support on Windows is coming soon. Developers will soon be able
swift buildto build applications without CMake or Ninja. In addition, developers can also use and
lldbdebug built applications in Windows :
Early adopters like Readdle are experimenting with developing cross-platform applications with Swift so that the same code can be used on different platforms, and many existing Swift libraries can be easily introduced to Windows. Alexander Smarus, product engineering director of the Readdle Spark team, shared his feelings about using Swift to develop cross-platform applications. He believes that although Swift's Windows support does not currently have certain features, it can fully meet his own needs. Alexander suggested that if you are considering extending your existing application code base to platforms other than macOS/iOS, you can definitely use Swift to achieve this goal immediately or at least soon. If you just maintain a small Swift library, you can now easily add Windows support.
The Swift team stated that supporting Swift on Windows is only the first step, and there are other parts of the ecosystem, such as lldb and Swift Package Manager and other tools that need to be ported to fully support cross-platform development.