Apple’s Swift Programming Now Works Under Windows

Swift

Thanks to the new Linux subsystem Microsoft introduced in build 14316, Apple’s open-source Swift programming language for building iOS and Mac apps now works under Windows as well. Reddit user vista980622 has shared the news in a post, while also explaining how to get Swift to work on any Windows 10 PC. To try it out, follow the steps after the jump.

GkPObp1

Step 1:

Go to Settings -> Update and Security -> Advanced -> Get Insider Builds.

Step 2:

Turn on “Fast Ring” on any Windows 10 PC and reboot to update.

Step 3:

Turn on “Developer mode” in “For Developers” on the “Update & Security” page.

Step 4:

Now go to Control Panel -> Program and Features -> Turn Windows Features on or off -> Windows SubSystem for Linux (Beta), and click OK.

Step 5:

After a reboot, open Command Line and type in “bash”. Then Windows will prompt to download Ubuntu image from the Windows Store, and once that’s done, just install Swift as how you install it in Ubuntu.

When unarchiving the tar.gz file, symbolic links will fail to create. Note down the few failures in bash, then go to Explorer, go to

C:\Users[Username]\AppData\Local\lxss\root, manually duplicate the relevant files + renaming them in Explorer. [Alternatively, you can cp them in bash as well].

After the setup, just go with ./swift [sourcefile].swift to compile and run it. Swift interactive shell does not yet work, but compilation of source file does work 🙂

This is still quite rough and experimental, but have fun 🙂

If all goes well, you should be able to get the Swift compiler up and running on your Windows PC.

Back in December, Apple announced Swift would go Open Source, as Apple Software Engineering SVP Craig Federighi explained it would allow for developers to create cross-platform apps, plus also allow educational institutions to use Swift in their curriculums, if they wanted to. Federighi also explained Apple would continue to support Objective-C “as far as we can see.”

 

P.S. Help support us and independent media here: Buy us a beer, Buy us a coffee, or use our Amazon link to shop.