目前最新的稳定版是 Swift 0.94.1
1.下载
wget http://swiftlang.org/packages/swift-0.94.1.tar.gz
解压
tar xfz swift-0.94.1.tar.gz
3.添加到PATH
export PATH=$PATH:~/swift-0.94.1/bin
接着
cd swift-0.94.1/examples/
swift hello.swift
我是这样做的,似乎文档过时了
bin/swift examples/swift/tutorial/hello.swift
结果如下所示
Swift 0.94.1 swift-r7114 cog-r3803
RunID: 20140603-1042-s00t01r6
Progress: time: Tue, 03 Jun 2014 10:42:05 +0800
Final status: Tue, 03 Jun 2014 10:42:05 +0800 Finished successfully:1
看看hello.swift
type messagefile;
app (messagefile t) greeting() {
echo "Hello, world!" stdout=@filename(t);
}
messagefile outfile <"hello.txt">;
outfile = greeting();
围观我的Github Idea墙, 也许,你会遇到心仪的项目