Good new for window user. Swift have supported on windows 10 right now, This article will be share for you how to setup swift and use it on window 10 🙂
1. Enable Ubuntu Bash Shell on windows 10
Step 1: Enable developer mode
– Settings -> Update and Security -> For developers, enable it by check into below radio button
Step 2: Enable Subsystem window for Linux environment
Control Panel -> Programs and Features -> Turn Windows Features On or Off -> Check into Windows Subsystem for Linux (Beta)
Step 3 – Download Bash On Ubuntu for Windows
Click to start button -> type “bash”
– “Bash” command will auto download Bash on Ubuntu into Windows. After this we go to create username and password to use in Bash environment later
After download Bash succeed, you can see same here.
2. Install required dependencies
– Setup clang libicu-dev “apt-get install clang libicu-dev”
– Use “sudo-su” command to change root permission to install the lib
3. Download the latest swift binary release
- Download latest version of Swift binary for Ubuntu 14.04 from here
- Create Swift folder in C driver
- Copy Swift binary into Swift folder
- Type command “cd /mnt/c/Swift“
4. Setup Swift
– Type “tar -zxvf swift-X.X.X-RELEASE-ubuntuX.X.tar.gz” command to extract folder and go to install Swift
– Install succeed!
5. Change directory to swift compiler bin
– cd “swift-X.X.X-RELEASE-ubuntuX.X/usr/bin”.
In this bin folder is the place create swift code file and compiler
In this bin folder is the place create swift code file and compiler
6. Write “Hello World” Swift On Windows 10
7. Compile và Run
– Compile helloworld.swift file by use command “./swiftc helloworld.swift”
– Run “./helloworld”