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日,蘋果開源語言的高級經(jīng)理Ted Kremenek在Swift官方博客上發(fā)布了一篇題為“Swift 3.0 Preview 1 Released!”的文章,介紹了Swift 3.0的第一個開發(fā)者預覽版:

正如Swift 3.0發(fā)布流程中提到的那樣,新的3.0開發(fā)者預覽版(包括seed或beta版)提供了合格的Swift 3 build包,而不僅是抓取master分支(即tip-of-trunk開發(fā))上的最新快照,這種方式所提供的Swift庫更為穩(wěn)定。

目前Swift 3的所有開發(fā)者預覽版都還處于開發(fā)階段,若非特別注明,都不是Swift 3的最終版。

下面列出了本次在Swift 3.0開發(fā)者預覽版第一版中所實現(xiàn)的Swift改進提案,此前為大家關注的幾項變動也在其中:

SE-0002: 刪除currying func聲明語法

SE-0003: 函數(shù)參數(shù)中不再使用var關鍵字

SE-0004: 刪除++與–操作符

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

SE-0006: 將API指南應用于標準庫中

SE-0007: 移除了C語言風格的for循環(huán)(條件與增量下)

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在代碼上變化極大,包含了許多語法優(yōu)化與更新,但在Objective-C API接入Swift的方式上也有巨大的變化(SE-0005),請參見遷移指南來查看遷移到Swift 3的指南與技巧。

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

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容