Code Monkey home page Code Monkey logo

swift-on-windows's Introduction

Swift on Windows

"           _  __ _   "
" ____ __ _(_)/ _| |_ "
"(_-< V  V / |  _|  _|"
"/__/\_/\_/|_|_|  \__|"

Compile and Build Swift Porject on Windows with the help of WSL

Requirements

  • Windows Subsystem for Linux (I have tried on Debian & Ubuntu Distro)
  • Python2.7 on WSL
  • (Optional) VSCode with SwiftLanguage Extension

Installing Swift

Visit https://swift.org/download/ and check for the latest release.

$ wget --no-check-certificat https://swift.org/builds/swift-4.2-release/ubuntu1604/swift-4.2-RELEASE/swift-4.2-RELEASE-ubuntu16.04.tar.gz

$ mkdir ~/swift
$ tar -xvzf swift-4.2-RELEASE-ubuntu16.04.tar.gz -C ~/swift

Dependences

$ sudo apt install python-swiftclient clang libicu-dev libpython2.7 libxml2 libcurl3 -y

IF you have problem getting libicu

$ wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu55_55.1-7_amd64.deb
$ sudo dpkg -i libicu55_55.1-7_amd64.deb
$ sudo apt-get -f install

Screenshot1.png

Create a Project

$ mkdir sampleProject && cd sampleProject
$ ~/swift/usr/bin/swift package init --type executable

Build & Run it manually

$ ~/swift/usr/bin/swift build 
$ ./.build/x86_64-unknown-linux/debug/sampleProject

Easy Build & Run Using VSCode Task

I have writen a vscode task, so that I can build & run my code my project without opening terminal.

  • Get the tasks.json and put it inside yourProjectFolder/.vscode
  • Build & Run using Ctrl+Shift+B
  • Be sure to have swift package at ~/swift/ (obviously you can change the directory inside tasks.json)

Swift on Windows with VSCode

swift-on-windows's People

Contributors

yazdipour avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

w3ss

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.