Ubuntu 14.04.4 下安装 Swift 2.2.1

Swift 2.2.1最近发布下载了是一个互动和有趣的编程语言,适用于iOSOS X,tvOSwatchOS语法简洁而富有表现力,应用程序运行快如闪电Swift 2.2带来了新的语法,新功能

功能特性:

Swift 2.2 includes support for Swift on Linux. The Linux port is still relatively new and in this release does not include the Swift Core Libraries (which will appear in Swift 3). The port does, however, include LLDB and the REPL.

Swift 2.2 introduces a new compiler directive that makes cross-version compatibility a cinch: you can now specify blocks of code that should be read only if the compiler supports a specific Swift language version

As of Swift 2.2, any keyword can be used as an argument label, with the exception of inout, var, and let

Swift 2.2 introduces the ability to compare two tuples for equality, which means it will check each element in one tuple against the matching element in another, and report true if all elements match

新功能完整细节见。

开发文档有Linux环境的,简单试下。Ubuntu 14.04.4 安装 Swift 2.2.1 过程见下面:

下载压缩包: https://swift.org/download/

选择自己的环境,下载对应的压缩包,我这里下载 swift-2.2.1-RELEASE-ubuntu14.04.tar.gz

https://swift.org/builds/swift-2.2.1-release/ubuntu1404/swift-2.2.1-RELEASE/swift-2.2.1-RELEASE-ubuntu14.04.tar.gz

到 home/www.linuxidc.com 目录下

# 解压缩
$ tar zxvf swift-2.2.1-RELEASE-ubuntu14.04.tar.gz

配置环境变量

# 编辑 .bashrc
vim ~/.bashrc

# 在文件底部插入环境变量
export PATH=swift-2.2.1-RELEASE-ubuntu14.04/usr/bin/:"${PATH}"

验证环境变量

@linuxidc:~$ export PATH=swift-2.2.1-RELEASE-ubuntu14.04/usr/bin/:"${PATH}"
@linuxidc:~$ swift
Welcome to Swift version 2.2.1 (swift-2.2.1-RELEASE). Type :help for assistance.
  1> var name = "www.linuxidc.com"
name: String = "www.linuxidc.com"
  2> var url = "http://\(name)"
url: String = "https://www.linuxidc.com"
  3> print("Hello, ")
Hello,
  4>

Ubuntu 14.04.4 下安装 Swift 2.2.1

最新的Ubuntu 14.04.4没有安装sudo apt-get install clang libicu-dev也可以。

Ubuntu 15.10安装部署Swift开发环境   

Swift 的变化:从 2.2 到 3.0 会带来什么   

Swift 正式开源,同时开源 Swfit 核心库和包管理器  

Apple Swift学习教程   

使用 Swift 构建一个 iOS 的邮件应用  

Swift 2.0开源化   

Linux下搭建Swift语言开发学习环境  

Swift 的详细介绍请点这里 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/15276.html