Swift 2.2.1最近发布下载了,是一个互动和有趣的编程语言,适用于iOS,OS X,tvOS和watchOS。语法简洁而富有表现力,应用程序运行快如闪电。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
, andlet
- 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}”
验证环境变量
www.linuxidc.com@linuxidc:~$ export PATH=swift-2.2.1-RELEASE-ubuntu14.04/usr/bin/:”${PATH}”
www.linuxidc.com@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 = “http://www.linuxidc.com”
3> print(“Hello, http://www.linuxidc.com”)
Hello, http://www.linuxidc.com
4>
最新的Ubuntu 14.04.4没有安装sudo apt-get install clang libicu-dev也可以。
Ubuntu 15.10安装部署Swift开发环境 http://www.linuxidc.com/Linux/2016-01/126995.htm
Swift 的变化:从 2.2 到 3.0 会带来什么 http://www.linuxidc.com/Linux/2015-12/126440.htm
Swift 正式开源,同时开源 Swfit 核心库和包管理器 http://www.linuxidc.com/Linux/2015-12/125847.htm
Apple Swift学习教程 http://www.linuxidc.com/Linux/2014-09/106420.htm
使用 Swift 构建一个 iOS 的邮件应用 http://www.linuxidc.com/Linux/2014-08/105542.htm
Swift 2.0开源化 http://www.linuxidc.com/Linux/2015-06/118594.htm
Linux下搭建Swift语言开发学习环境 http://www.linuxidc.com/Linux/2015-12/125983.htm
Swift 的详细介绍:请点这里
更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-05/131249.htm