aster.cloud aster.cloud
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
aster.cloud aster.cloud
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
  • Programming
  • Software
  • Tech

Introducing Swift On Windows

  • aster.cloud
  • September 23, 2020
  • 5 minute read

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.


Partner with aster.cloud
for your next big idea.
Let us know here.



From our partners:

CITI.IO :: Business. Institutions. Society. Global Political Economy.
CYBERPOGO.COM :: For the Arts, Sciences, and Technology.
DADAHACKS.COM :: Parenting For The Rest Of Us.
ZEDISTA.COM :: Entertainment. Sports. Culture. Escape.
TAKUMAKU.COM :: For The Hearth And Home.
ASTER.CLOUD :: From The Cloud And Beyond.
LIWAIWAI.COM :: Intelligence, Inside and Outside.
GLOBALCLOUDPLATFORMS.COM :: For The World's Computing Needs.
FIREGULAMAN.COM :: For The Fire In The Belly Of The Coder.
ASTERCASTER.COM :: Supra Astra. Beyond The Stars.
BARTDAY.COM :: Prosperity For Everyone.

 

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

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

Calculator app written in Swift running on Windows

This project was built using:

  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
Read More  Introducing Swift Atomics

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:

LLDB console debugging Swift application on Windows

 

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.

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.

Read More  Let's Build A Windows Virtual Machine

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.

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!

Read More  Android Dev Summit 2019 | Preparing for Scoped Storage

 

Saleem Abdulrasool is a member of the Swift Core Team and a software engineer at Google Brain.

For enquiries, product placements, sponsorships, and collaborations, connect with us at [email protected]. We'd love to hear from you!

Our humans need coffee too! Your support is highly appreciated, thank you!

aster.cloud

Related Topics
  • Readdle
  • Swift
  • Swift Bug Tracker
  • Windows
You May Also Like
Getting things done makes her feel amazing
View Post
  • Computing
  • Data
  • Featured
  • Learning
  • Tech
  • Technology

Nurturing Minds in the Digital Revolution

  • April 25, 2025
View Post
  • Software
  • Technology

Canonical Releases Ubuntu 25.04 Plucky Puffin

  • April 17, 2025
View Post
  • Software
  • Technology

IBM Accelerates Momentum in the as a Service Space with Growing Portfolio of Tools Simplifying Infrastructure Management

  • March 27, 2025
View Post
  • Tech

Deep dive into AI with Google Cloud’s global generative AI roadshow

  • February 18, 2025
Volvo Group: Confidently ahead at CES
View Post
  • Tech

Volvo Group: Confidently ahead at CES

  • January 8, 2025
zedreviews-ces-2025-social-meta
View Post
  • Featured
  • Gears
  • Tech
  • Technology

What Not to Miss at CES 2025

  • January 6, 2025
Vehicle manufacturing
View Post
  • Software

IBM Study: Vehicles Believed to be Software Defined and AI Powered by 2035

  • December 12, 2024
View Post
  • Tech

IBM and Pasqal Plan to Expand Quantum-Centric Supercomputing Initiative

  • November 21, 2024

Stay Connected!
LATEST
  • 1
    Pulsant targets partner diversity with new IaaS solution
    • May 23, 2025
  • 2
    Growing AI workloads are causing hybrid cloud headaches
    • May 23, 2025
  • Gemma 3n 3
    Announcing Gemma 3n preview: powerful, efficient, mobile-first AI
    • May 22, 2025
  • 4
    Google is getting serious on cloud sovereignty
    • May 22, 2025
  • oracle-ibm 5
    Google Cloud and Philips Collaborate to Drive Consumer Marketing Innovation and Transform Digital Asset Management with AI
    • May 20, 2025
  • 6
    Hybrid cloud is complicated – Red Hat’s new AI assistant wants to solve that
    • May 20, 2025
  • notta-ai-header 7
    Notta vs Fireflies: Which AI Transcription Tool Deserves Your Attention in 2025?
    • May 16, 2025
  • 8
    Cloud adoption isn’t all it’s cut out to be as enterprises report growing dissatisfaction
    • May 15, 2025
  • college-of-cardinals-2025 9
    The Definitive Who’s Who of the 2025 Papal Conclave
    • May 7, 2025
  • conclave-poster-black-smoke 10
    The World Is Revalidating Itself
    • May 6, 2025
about
Hello World!

We are aster.cloud. We’re created by programmers for programmers.

Our site aims to provide guides, programming tips, reviews, and interesting materials for tech people and those who want to learn in general.

We would like to hear from you.

If you have any feedback, enquiries, or sponsorship request, kindly reach out to us at:

[email protected]
Most Popular
  • oracle-ibm 1
    IBM and Oracle Expand Partnership to Advance Agentic AI and Hybrid Cloud
    • May 6, 2025
  • 2
    Conclave: How A New Pope Is Chosen
    • April 25, 2025
  • Getting things done makes her feel amazing 3
    Nurturing Minds in the Digital Revolution
    • April 25, 2025
  • 4
    Canonical Releases Ubuntu 25.04 Plucky Puffin
    • April 17, 2025
  • 5
    United States Army Enterprise Cloud Management Agency Expands its Oracle Defense Cloud Services
    • April 15, 2025
  • /
  • Technology
  • Tools
  • About
  • Contact Us

Input your search keywords and press Enter.