Swift 3.0 是 Swift 宣布开源后的首页主要发行版本,包含众多关于核心语言以及标准库的主要改进和优化,同时包含 Swift 在 Linux 上移植的版本,以及官方首个 Swift Package Manager 版本。
Swift 3.0 是一个主要语言发行版本,在源码上与 Swift 2.2 和 2.3 并不兼容,包含了如下的语言特性的变化:
SE-0007: Remove C-style for-loops with conditions and incrementers
SE-0016: Adding initializers to Int and UInt to convert from UnsafePointer and UnsafeMutablePointer
SE-0029: Remove implicit tuple splat behavior from function applications
SE-0034: Disambiguating Line Control Statements from Debugging Identifiers
SE-0036: Requiring Leading Dot Prefixes for Enum Instance Member Implementations
SE-0040: Replacing Equal Signs with Colons For Attribute Arguments
SE-0043: Declare variables in ‘case’ labels with multiple patterns
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-0049: Move @noescape and @autoclosure to be type attributes
SE-0053: Remove explicit use of
let
from Function ParametersSE-0055: Make unsafe pointer nullability explicit using Optional
SE-0059: Update API Naming Guidelines and Rewrite Set APIs Accordingly
SE-0061: Add Generic Result and Error Handling to autoreleasepool()
SE-0064: Referencing the Objective-C selector of property getters and setters
SE-0066: Standardize function type argument syntax to require parentheses
SE-0072: Fully eliminate implicit bridging conversions from Swift
SE-0088: Modernize libdispatch for Swift 3 naming conventions
SE-0094: Add sequence(first:next:) and sequence(state:next:) to the stdlib
SE-0096: Converting dynamicType from a property to an operator
SE-0101: Reconfiguring
sizeof
and related functions into a unifiedMemoryLayout
structSE-0102: Remove
@noreturn
attribute and introduce an emptyNever
typeSE-0106: Add a
macOS
Alias for theOSX
Platform Configuration TestSE-0111: Remove type system significance of function argument labels
SE-0117: Allow distinguishing between public access and public overridability
SE-0124:
Int.init(ObjectIdentifier)
andUInt.init(ObjectIdentifier)
should have abitPattern:
labelSE-0128: Change failable UnicodeScalar initializers to failable
SE-0130: Replace repeating
Character
andUnicodeScalar
forms of String.initSE-0135: Package Manager Support for Differentiating Packages by Swift version