Swift 3.0开发者预览版(第一版)发布内容简介

来源:互联网 发布:java从入门到精通第3版 编辑:程序博客网 时间:2024/05/22 11:44

导读:从去年年底至今,全球iOS开发者一直在期待以及展望Swift 3,在凌晨“开放”成重点的WWDC上,苹果实现了Siri、iMessage等软件在多平台的打通及开放,而对于开发者而言,最为关注的莫过于Xcode和Swift的更新。

北京时间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官方博客,文/孙薇 责编/唐小引,欢迎技术投稿、约稿、给文章纠错,请发送邮件至tangxy@csdn.net)

0 0
原创粉丝点击