Swift 3.0

Swift 3.0 Preview 1 Released!

JUNE 13, 2016Ted Kremenek Ted Kremenek

We are very pleased to announce Developer Preview 1 of Swift 3.0!

As described in the Swift 3.0 Release Process, developer previews (i.e., “seeds” or “betas”) provide qualified builds of Swift 3 that are more stable than just grabbing the latest snapshot of master (i.e., tip-of-trunk development). Developer previews capture Swift 3 as a work-in-progress and should not be considered the final version of Swift 3 unless otherwise stated.

Implemented Swift Evolution Proposals

The following Swift Evolution proposals are newly implemented in Swift 3.0 Preview 1:

SE-0002: Removing currying func declaration syntax

SE-0003: Removing var from Function Parameters

SE-0004: Remove the ++ and -- operators

SE-0005: Better Translation of Objective-C APIs Into Swift

SE-0006: Apply API Guidelines to the Standard Library

SE-0007: Remove C-style for-loops with conditions and incrementers

SE-0008: Add a Lazy flatMap for Sequences of Optionals

SE-0016: Adding initializers to Int and UInt to convert from UnsafePointer and UnsafeMutablePointer

SE-0017: Change Unmanaged to use UnsafePointer

SE-0019: Swift Testing

SE-0023: API Design Guidelines

SE-0028: Modernizing Swift’s Debugging Identifiers (__FILE__, etc)

SE-0029: Remove implicit tuple splat behavior from function applications

SE-0031: Adjusting inout Declarations for Type Decoration

SE-0032: Add first(where:) method to SequenceType

SE-0033: Import Objective-C Constants as Swift Types

SE-0034: Disambiguating Line Control Statements from Debugging Identifiers

SE-0037: Clarify interaction between comments & operators

SE-0039: Modernizing Playground Literals

SE-0040: Replacing Equal Signs with Colons For Attribute Arguments

SE-0043: Declare variables in ‘case’ labels with multiple patterns

SE-0044: Import as Member

SE-0046: Establish consistent label behavior across all parameters including first labels

SE-0047: Defaulting non-Void functions so they warn on unused results

SE-0048: Generic Type Aliases

SE-0049: Move @noescape and @autoclosure to be type attributes

SE-0053: Remove explicit use of let from Function Parameters

SE-0054: Abolish ImplicitlyUnwrappedOptional type

SE-0055: Make unsafe pointer nullability explicit using Optional

SE-0057: Importing Objective-C Lightweight Generics

SE-0059: Update API Naming Guidelines and Rewrite Set APIs Accordingly

SE-0061: Add Generic Result and Error Handling to autoreleasepool()

SE-0062: Referencing Objective-C key-paths

SE-0064: Referencing the Objective-C selector of property getters and setters

SE-0065: A New Model For Collections and Indices

SE-0066: Standardize function type argument syntax to require parentheses

SE-0069: Mutability and Foundation Value Types

SE-0070: Make Optional Requirements Objective-C-only

SE-0071: Allow (most) keywords in member references

SE-0085: Package Manager Command Names

SE-0094: Add sequence(first:next:) and sequence(state:next:) to the stdlib

Downloads

Apple (Xcode)

Swift 3.0 Preview 1 is available for free as part of Xcode 8 beta 1.

Linux (Ubuntu 14.04 and Ubuntu 15.10)

Official binaries for Ubuntu 14.04 and Ubuntu 15.10 are available for download on Swift.org.

Documentation

An updated version of The Swift Programming Language for Swift 3.0 is now available on Swift.org. It is also available for free on Apple’s iBooks store.

Foundation and Linux (Core Libraries)

Not all of the NS prefix removal changes have propagated to the Core Libraries implementation of Foundation APIs. This should be resolved in a future beta.

Migrating to Swift 3

Swift 3 is a source-breaking release over Swift 2.2.1. It contains many syntactic refinements and improvements, but also a huge number of changes for how Objective-C APIs import into Swift due to SE-0005. Please consult the migration guide for guidance and tips for migrating to Swift 3.


北京时间6月14日,苹果开源语言的高级经理Ted Kremenek在Swift官方博客上发布了一篇题为“Swift 3.0 Preview 1 Released!”的文章,介绍了Swift 3.0的第一个开发者预览版:

正如Swift 3.0发布流程中提到的那样,新的3.0开发者预览版(包括seed或beta版)提供了合格的Swift 3 build包,而不仅是抓取master分支(即tip-of-trunk开发)上的最新快照,这种方式所提供的Swift库更为稳定。

目前Swift 3的所有开发者预览版都还处于开发阶段,若非特别注明,都不是Swift 3的最终版。

下面列出了本次在Swift 3.0开发者预览版第一版中所实现的Swift改进提案,此前为大家关注的几项变动也在其中:

SE-0002: 删除currying func声明语法

SE-0003: 函数参数中不再使用var关键字

SE-0004: 删除++与–操作符

SE-0005: 将Objective-C的API更好地接入Swift中

SE-0006: 将API指南应用于标准库中

SE-0007: 移除了C语言风格的for循环(条件与增量下)

SE-0008: 为可选序列增加一个Lazy flatMap

SE-0019: Swift测试

SE-0023: API设计指南

SE-0028: 更新Swift的debug标识符(如__FILE__等)

SE-0048: 泛型类型别名

SE-0049: 将声明式@noescape与@autoclosure改为类型属性

其他变更还有:

SE-0016: Adding initializers to Int and UInt to convert from UnsafePointer and UnsafeMutablePointer

SE-0017: Change Unmanaged to use UnsafePointer

SE-0029: Remove implicit tuple splat behavior from function applications

SE-0031: Adjusting inout Declarations for Type Decoration

SE-0032: Add first(where:) method to SequenceType

SE-0033: Import Objective-C Constants as Swift Types

SE-0034: Disambiguating Line Control Statements from Debugging Identifiers

SE-0037: Clarify interaction between comments & operators

SE-0039: Modernizing Playground Literals

SE-0040: Replacing Equal Signs with Colons For Attribute Arguments

SE-0043: Declare variables in ‘case’ labels with multiple patterns

SE-0044: Import as Member

SE-0046: Establish consistent label behavior across all parameters including first labels

SE-0047: Defaulting non-Void functions so they warn on unused results

SE-0053: Remove explicit use of let from Function Parameters

SE-0054: Abolish ImplicitlyUnwrappedOptional type

SE-0055: Make unsafe pointer nullability explicit using Optional

SE-0057: Importing Objective-C Lightweight Generics

SE-0059: Update API Naming Guidelines and Rewrite Set APIs Accordingly

SE-0061: Add Generic Result and Error Handling to autoreleasepool()

SE-0062: Referencing Objective-C key-paths

SE-0064: Referencing the Objective-C selector of property getters and setters

SE-0065: A New Model For Collections and Indices

SE-0066: Standardize function type argument syntax to require parentheses

SE-0069: Mutability and Foundation Value Types

SE-0070: Make Optional Requirements Objective-C-only

SE-0071: Allow (most) keywords in member references

SE-0085: Package Manager Command Names

SE-0094: Add sequence(first:next:) and sequence(state:next:) to the stdlib

下载:

苹果(Xcode)

Swift 3.0预览版第一版目前可作为Xcode 8 beta 1的一部分免费下载。

Linux (Ubuntu 14.04 and Ubuntu 15.10)

可用于Ubuntu 14.04和Ubuntu 15.10的官方版目前可在Swift.org下载。

文档:

适用于Swift 3.0的《Swift编程语言》文档目前可以在Swift.org下载,在苹果的iBooks商店也可以免费下载。

迁移到Swift 3

Swift 3与Swift 2.2.1在代码上变化极大,包含了许多语法优化与更新,但在Objective-C API接入Swift的方式上也有巨大的变化(SE-0005),请参见迁移指南来查看迁移到Swift 3的指南与技巧。

(本文参考自Swift官方博客, csdn.net)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,324评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,303评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,192评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,555评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,569评论 5 365
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,566评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,927评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,583评论 0 257
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,827评论 1 297
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,590评论 2 320
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,669评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,365评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,941评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,928评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,159评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,880评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,399评论 2 342

推荐阅读更多精彩内容