So, you want to learn the language, but don’t want to buy a Mac? It is possible. Actually I have just downloaded the 2nd edition of the Swift Programming from Big Nerd Ranch, when I realised, that I don’t have access to my beloved Mac, only the company’s HP notebook.
First of all, you have to know that the Swift programming language itself is open source. But this is only the language, which usually gives the programmer the basic operations and expressions. Those language basics are covered the book mentioned above, or the official Apple Swift book, which can be downloaded, or available online for free.
The “magic”, which helps you create application for iOS devices, such as iPhone and iPad, or for Macs lives in the rich framework ecosystem, which provided by Apple. That rich framework set hasn’t been open sourced, which means that you still need to have a macOS to develop iOS or macOS applications in Swift. For example UIKit framework gives you the ability to use iOS and tvOS user interface, and Cocoa framework does the same for desktop (Mac) application development.
There are other framework, like Foundation. This is also open sourced, since this framework helps Swift with some basic behaviour and expressions.
How to learn coding Swift on Windows
So, on a Windows machine you can not use the Swift language to build iOS or macOS applications, but you can still learn the language, and build web based application. The only thing you need is internet access and a web browser.
The IBM Swift Sandbox is a web based, online Swift interactive website, where you can edit and run Swift code, and eventually save it. The Xcode development environment, which is the main software to create iOS, watchOS, macOS and tvOS apps has a similar functionality, called playground. The solution provided by IBM is very similar, except that you can not use the rich user interface API, only the basic language features. I think for learning you don’t really need too much more.
Get it via Docker
If you have already familiar with Docker, (or you might came from Linux environment, where docker has more reputation) there is an official IBM docker image for your disposal on GitHub. Unfortunately Docker only supported by Windows 10.
Chose any option above, I wish you happy coding!