Run Swift



The Swift project is introducing new downloadable Swift toolchain images for Windows! These images contain development components needed to build and run Swift code on Windows.

For over a year now, there has been a significant endeavour to port Swift to Windows in conjunction with the developer community at swift.org. The Windows support is now at a point where early adopters can start using Swift to build real experiences on this platform.

Bringing Swift to Windows

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.

Example Application

In order to make the Swift on Windows development process easier, Swift project yesterday released new downloadable Swift toolchain images for Windows. These images contain development components needed to build and run Swift code on Windows. You can find instructions on how to setup Swift on Windows development environment here. More support to keep you at the peak of fitness; the Men's Nike Run Swift 2 Running Shoe. Breathable mesh upper in a running shoe style with a round toe Flywire lace up cables for a secure fit Padded collar and tongue for added comfort.

Swift Run Campground

This demo calculator is written entirely in Swift, with code seamlessly flipping between the application code written in Swift and the system libraries:

This project was built using:

The landscape in Zwift is epic. Run through the jungle, improve your speedwork through the countryside, and sprint inside a volcano with thousands by your side. ' Zwift is offering up something pretty unique that all runners should try at least once. These men's Nike Run Swift shoes blend highly breathable mesh and tightly woven mesh in the midfoot for support. Integrated Flywire cables provide midfoot lockdown, while Cushlon foam delivers a responsive ride. Watch the product video here. Tightly woven mesh in the quarter panel provides durable support without sacrificing. Free shipping BOTH ways on nike run swift from our vast selection of styles. Fast delivery, and 24/7/365 real-person service with a smile. Click or call 800-927-7671.

  1. The Swift toolchain on Windows

  2. An installation of Visual Studio 2019 which delivers the other needed pieces in the form of CMake, Ninja, and the Windows SDK

Although the demo application is built with CMake, Swift Package Manager support on Windows is coming along. It will soon be possible to get the application building using swift build without needing CMake or Ninja.

Here you can see stepping through the application using lldb:

Cross-Platform Applications

Early adopters like Readdle are experimenting with cross-platform applications written in Swift, easily bringing many of the existing Swift libraries to Windows to support their applications.

I had been working with Alexander at Readdle about his team’s work, and he sent me this note:

We at Readdle started experimenting with Swift on Windows more than a year ago, in Q2 of 2019. By that time we already released Spark for Android which uses Swift to share core code with iOS/macOS, and the opportunity to extend to one more platform was really tempting.

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.

What we have now:

  • 9 Swift modules (255 739 SLOC, 2 133 source files)
  • 3 third party swift modules
  • 1452 tests (powered by XCTest)
  • Windows-based CI to keep all tests green
  • Heterogenous build system (partially CMake, partially custom scripts)

As a good example, pure Swift modules like CryptoSwift and OAuthSwift almost worked right out of the box. We did trivial imports adjustment, excluded a few AppKit/UIKit references and voilà!

Another challenge was to decide how to implement the user interface. After extensive discourse we ended up with Electron as the front-end part of future Spark for Windows. That meant we not only needed to be able to build Spark Core on Windows but also use it as a loadable addon for Node.js.

Swift

Node.js addon in pure Swift? That appeared to be surprisingly easy. Swift perfectly imports N-API headers. We still need three lines of C code plus one small C header to define addon entry point, but all logic is in Swift. Due to the crossplatform nature of Node.js, we were able to use macOS as a development platform with Xcode as IDE, and then use the agility of CMake to build the same code on Windows.

Since the first day we started, Swift on Windows did a giant step forward in terms of platform support and stability. I’d say, if you are thinking about extending your existing application codebase to platforms other than macOS/iOS – you absolutely can do it with Swift now, or, at least, soon. If you are maintaining a small Swift library – you could easily add Windows support already!

— Alexander Smarus; Product Engineering Lead at Spark Team, Readdle Inc

More details are available on Readdle’s blog.

Adding support for Windows to Swift is the beginning of a journey. The current support sets the first milestone where the language is usable. There is yet another even broader part of the ecosystem like lldb and the Swift Package Manager which still need more work to be as complete in their support for this different platform.

Getting Started and Getting Involved!

The Getting Started section has been updated with new information about using Swift on Windows! For the early adopters who are getting started and finding issues, please report them to the Swift Bug Tracker.

There are many opportunities for those interested in helping push Swift on Windows forward. One of the things that makes Swift easy to use is libraries: publishing new libraries and packages for Swift on Windows or porting existing ones is another way to get involved and help make working with Swift an ever greater delight.

Adidas Swift Run Kids

For the ones interested in working on core tooling, there is plenty of work to be done to improve the debugger and to improve the Windows support in the Swift Package Manager. We invite you to check out the Swift Bug Tracker for the current issues and to send patches to the GitHub repositories. There is also a new section on the Swift forums to discuss the development of Swift on Windows. There the community can discuss issues or you can introduce yourself and let others know what area of the tooling you are focusing on. This is the perfect opportunity to become involved in the project and help it grow into a strong, vibrant, cross-platform ecosystem. We cannot wait to see what exciting things you build with Swift!

Developers are doing
great things with Swift.

Swift is a fast and efficient language that provides real-time feedback and can be seamlessly incorporated into existing Objective-C code. So developers are able to write safer, more reliable code, save time, and create even richer app experiences.

Great apps
built using Swift.

Run swift running shoe

More and more developers are incorporating Swift code into their apps. And some are even building all-new apps entirely in Swift.

Better performance
equals better apps.

Swift apps more than live up to the name. For instance, a common search algorithm completes much faster using Swift.

10,000 integers found in a graph
using depth-first search algorithm*

Educators are adding Swift
to their curriculum.

Developers aren’t the only ones who’ve experienced the potential of Swift. Universities and academic institutions around the world teach with Swift and Xcode on Mac, empowering their students with the best tools to build amazing apps. And with Apple’s free Develop in Swift curriculum, the transition from introductory coding to app development with Swift has never been easier.

Colleges and universities that are incorporating Swift into their courses

  • Aberystwyth University
  • Borough of Manhattan
    Community College
  • California Polytechnic State University
  • Central Piedmont Community College
  • Foothill College
  • Full Sail University
  • Houston Community College System
  • Ingésup
  • Lawson State Community College
  • Mesa Community College
  • Northwest Kansas Technical College
  • Plymouth University
  • RMIT University
  • Southern Methodist University
  • Stanford University
  • Technical University of Munich
  • Tecnológico de Monterrey
  • University of California, Santa Cruz

Adidas Run Swift

Swift is everywhere.
And now it’s open for everyone.

Swift is free and open source, and it’s available to a wide audience of developers, educators, and students under the Apache 2.0 open source license. We’re providing binaries for macOS and Linux that can compile code for iOS, macOS, watchOS, tvOS, and Linux. And to help Swift grow into an even more powerful language, we created a community where users can contribute directly to the Swift source code.

Get started with Swift.

The Definitive Book

Download The Swift Programming Language from the Apple Books Store free. Learn how Swift makes programming easier, more flexible, and more fun.

Download the free book

Xcode

Xcode is the Mac app used to build every other Mac app and every iOS app, too. It has all the tools you need to create an amazing app experience. And it’s available as a free download from the Mac App Store.

Download Xcode from the
Mac App Store

Run Swift 2 Nike

Developer Website

Get detailed technical information and an advanced overview of Swift. Check out the developer blog and stay up to date on the latest news. And enjoy free access to great resources like guides, videos, and sample code.

Run Swift Running Shoe

Learn more