如果你想在Ubuntu安装的Xcode,那是不可能的,因为已经指出的迪帕克:Xcode是不能用于Linux在这个时候,我不希望它是在可预见的未来。
但是,如果你想在Ubuntu上安装Swift,并从命令行使用它,那很容易。该指令是在http://www.swift.org现场,但这里是一个简要的回顾一下,假设你是在你的home目录:
1)下载的分布:
[email protected]:~$ wget https://swift.org/builds/swift-2.2-release/ubuntu1404/swift-2.2-RELEASE/swift-2.2-RELEASE-ubuntu14.04.tar.gz
2)打开它:
[email protected]:~$ tar xf swift-2.2-RELEASE-ubuntu14.04.tar.gz
3)预先设置的二进制文件到您的$PATH位置:
[email protected]:~$ export PATH=$HOME/swift-2.2-RELEASE-ubuntu14.04/usr/bin:$PATH
这就是安装。现在你可以用它做一些事情,这些只是例子。
运行REPL:
[email protected]:~$ swift
Welcome to Swift version 2.2 (swift-2.2-RELEASE). Type :help for assistance.
1> 1 + 3
$R0: Int = 4
2> :quit
[email protected]:~$
创建斯威夫特源文件,