Cloud9 IDE/Swift

From Wikiversity
Jump to navigation Jump to search

Cloud9 may be for Swift development, but by default the Swift development environment is not installed. This is indicated by the following error when running a .swift file:

bash: line 1: ...: No such file or directory

To install Swift, enter the following commands at the bash prompt. If you don't see a bash prompt, open a New Terminal window.

sudo apt-get update
sudo apt-get -y install clang libicu-dev
mkdir ~/downloads
cd ~/downloads
wget https://swift.org/builds/swift-4.2.1-release/ubuntu1404/swift-4.2.1-RELEASE/swift-4.2.1-RELEASE-ubuntu14.04.tar.gz
mkdir ~/swift
tar xzf swift-4.2.1-RELEASE-ubuntu14.04.tar.gz -C ~/swift --strip-components 1
echo 'export PATH=~/swift/usr/bin:$PATH' >>~/.profile
cd ~/workspace
rm -r ~/downloads

Then add a new runner for Swift files with the following configuration. Save the new runner as Swift.run:

{
    "cmd" : ["swift", "$file", "$args"],
    "info" : "Running $file_name",
    "selector" : "source.swift"
}

See Also[edit | edit source]