diff --git a/source/02_language_guide/01_The_Basics.md b/source/02_language_guide/01_The_Basics.md index 8eebdc09..446e450e 100755 --- a/source/02_language_guide/01_The_Basics.md +++ b/source/02_language_guide/01_The_Basics.md @@ -481,7 +481,7 @@ print("The status message is \(http200Status.description)") > 注意 > -> 当遇到一些相关值的简单分组时,元组是很有用的。元组不适合用来创建复杂的数据结构。如果你的数据结构比较复杂,不要使用元组,用类或结构体去建模。欲获得更多信息,请参考 [结构体和类](./09_Classes_and_Structures.md)。 +> 当遇到一些相关值的简单分组时,元组是很有用的。元组不适合用来创建复杂的数据结构。如果你的数据结构比较复杂,不要使用元组,用类或结构体去建模。欲获得更多信息,请参考 [结构体和类](./09_Structures_And_Classes.md)。 ## 可选类型 {#optionals} diff --git a/source/02_language_guide/02_Basic_Operators.md b/source/02_language_guide/02_Basic_Operators.md index fd524e1b..de370cb6 100755 --- a/source/02_language_guide/02_Basic_Operators.md +++ b/source/02_language_guide/02_Basic_Operators.md @@ -168,7 +168,7 @@ Swift 支持以下的比较运算符: > 注意 > -> Swift 也提供恒等(`===`)和不恒等(`!==`)这两个比较符来判断两个对象是否引用同一个对象实例。更多细节在 [类与结构](./09_Classes_and_Structures.md) 章节的 **Identity Operators** 部分。 +> Swift 也提供恒等(`===`)和不恒等(`!==`)这两个比较符来判断两个对象是否引用同一个对象实例。更多细节在 [类与结构](./09_Structures_And_Classes.md) 章节的 **Identity Operators** 部分。 每个比较运算都返回了一个标识表达式是否成立的布尔值: diff --git a/source/02_language_guide/03_Strings_and_Characters.md b/source/02_language_guide/03_Strings_and_Characters.md index 6bbede7a..fbca6c2b 100755 --- a/source/02_language_guide/03_Strings_and_Characters.md +++ b/source/02_language_guide/03_Strings_and_Characters.md @@ -157,7 +157,7 @@ constantString += " and another Highlander" ## 字符串是值类型 {#strings-are-value-types} -在 Swift 中 `String` 类型是*值类型*。如果你创建了一个新的字符串,那么当其进行常量、变量赋值操作,或在函数/方法中传递时,会进行值拷贝。在前述任一情况下,都会对已有字符串值创建新副本,并对该新副本而非原始字符串进行传递或赋值操作。值类型在 [结构体和枚举是值类型](./09_Classes_and_Structures.md#structures-and-enumerations-are-value-types) 中进行了详细描述。 +在 Swift 中 `String` 类型是*值类型*。如果你创建了一个新的字符串,那么当其进行常量、变量赋值操作,或在函数/方法中传递时,会进行值拷贝。在前述任一情况下,都会对已有字符串值创建新副本,并对该新副本而非原始字符串进行传递或赋值操作。值类型在 [结构体和枚举是值类型](./09_Structures_And_Classes.md#structures-and-enumerations-are-value-types) 中进行了详细描述。 Swift 默认拷贝字符串的行为保证了在函数/方法向你传递的字符串所属权属于你,无论该值来自于哪里。你可以确信传递的字符串不会被修改,除非你自己去修改它。 diff --git a/source/02_language_guide/04_Collection_Types.md b/source/02_language_guide/04_Collection_Types.md index d1a4df39..f6a48fc4 100755 --- a/source/02_language_guide/04_Collection_Types.md +++ b/source/02_language_guide/04_Collection_Types.md @@ -235,7 +235,7 @@ for (index, value) in shoppingList.enumerated() { // Item 5: Bananas ``` -更多关于 `for-in` 循环的介绍请参见 [For 循环](05_Control_Flow.html#for-loops)。 +更多关于 `for-in` 循环的介绍请参见 [For 循环](./05_Control_Flow.md#for-loops)。 ## 集合(Sets) {#sets} diff --git a/source/02_language_guide/05_Control_Flow.md b/source/02_language_guide/05_Control_Flow.md index cd375168..5b031f7d 100755 --- a/source/02_language_guide/05_Control_Flow.md +++ b/source/02_language_guide/05_Control_Flow.md @@ -527,7 +527,7 @@ default: - `return` - `throw` -我们将会在下面讨论 `continue`、`break` 和 `fallthrough` 语句。`return` 语句将会在 [函数](./06_Functions.md) 章节讨论,`throw` 语句会在 [错误抛出](./18_Error_Handling.md#throwing-errors) 章节讨论。 +我们将会在下面讨论 `continue`、`break` 和 `fallthrough` 语句。`return` 语句将会在 [函数](./06_Functions.md) 章节讨论,`throw` 语句会在 [错误抛出](./17_Error_Handling.md#throwing-errors) 章节讨论。 ### Continue {#continue} @@ -754,7 +754,7 @@ if #available(iOS 10, macOS 10.12, *) { 以上可用性条件指定,`if` 语句的代码块仅仅在 iOS 10 或 macOS 10.12 及更高版本才运行。最后一个参数,`*`,是必须的,用于指定在所有其它平台中,如果版本号高于你的设备指定的最低版本,if 语句的代码块将会运行。 -在它一般的形式中,可用性条件使用了一个平台名字和版本的列表。平台名字可以是 `iOS`,`macOS`,`watchOS` 和 `tvOS`——请访问 [声明属性](../03_language_reference/06_Attributes.html) 来获取完整列表。除了指定像 iOS 8 或 macOS 10.10 的大版本号,也可以指定像 iOS 11.2.6 以及 macOS 10.13.3 的小版本号。 +在它一般的形式中,可用性条件使用了一个平台名字和版本的列表。平台名字可以是 `iOS`,`macOS`,`watchOS` 和 `tvOS`——请访问 [声明属性](../03_language_reference/07_Attributes.md) 来获取完整列表。除了指定像 iOS 8 或 macOS 10.10 的大版本号,也可以指定像 iOS 11.2.6 以及 macOS 10.13.3 的小版本号。 ```swift if #available(平台名称 版本号, ..., *) { diff --git a/source/02_language_guide/10_Properties.md b/source/02_language_guide/10_Properties.md index aefc4fb9..cc6f37f6 100755 --- a/source/02_language_guide/10_Properties.md +++ b/source/02_language_guide/10_Properties.md @@ -245,7 +245,7 @@ print("the volume of fourByFiveByTwo is \(fourByFiveByTwo.volume)") > > 在父类初始化方法调用之后,在子类构造器中给父类的属性赋值时,会调用父类属性的 `willSet` 和 `didSet` 观察器。而在父类初始化方法调用之前,给子类的属性赋值时不会调用子类属性的观察器。 > -> 有关构造器代理的更多信息,请参考 [值类型的构造器代理](./14_Initialization.md#initializer-delegation-for-value-types) 和 [类的构造器代理](./14-Initialization.md#initializer-delegation-for-class-types)。 +> 有关构造器代理的更多信息,请参考 [值类型的构造器代理](./14_Initialization.md#initializer-delegation-for-value-types) 和 [类的构造器代理](./14_Initialization.md#initializer-delegation-for-class-types)。 下面是一个 `willSet` 和 `didSet` 实际运用的例子,其中定义了一个名为 `StepCounter` 的类,用来统计一个人步行时的总步数。这个类可以跟计步器或其他日常锻炼的统计装置的输入数据配合使用。 @@ -284,7 +284,7 @@ stepCounter.totalSteps = 896 > 注意 > -> 如果将带有观察器的属性通过 in-out 方式传入函数,`willSet` 和 `didSet` 也会调用。这是因为 in-out 参数采用了拷入拷出内存模式:即在函数内部使用的是参数的 copy,函数结束后,又对参数重新赋值。关于 in-out 参数详细的介绍,请参考 [输入输出参数](../03_language_reference/05_Declarations.html#in-out-parameters)。 +> 如果将带有观察器的属性通过 in-out 方式传入函数,`willSet` 和 `didSet` 也会调用。这是因为 in-out 参数采用了拷入拷出内存模式:即在函数内部使用的是参数的 copy,函数结束后,又对参数重新赋值。关于 in-out 参数详细的介绍,请参考 [输入输出参数](../03_language_reference/06_Declarations.md#in-out-parameters)。 ## 属性包装器 {#property-wrappers} 属性包装器在管理属性如何存储和定义属性的代码之间添加了一个分隔层。举例来说,如果你的属性需要线程安全性检查或者需要在数据库中存储它们的基本数据,那么必须给每个属性添加同样的逻辑代码。当使用属性包装器时,你只需在定义属性包装器时编写一次管理代码,然后应用到多个属性上来进行复用。 @@ -306,7 +306,7 @@ struct TwelveOrLess { 这个 setter 确保新值小于 12,而且返回被存储的值。 > 注意 > -> 上面例子以 `private` 的方式声明 `number` 变量,这使得 `number` 仅在 `TwelveOrLess` 的实现中使用。写在其他地方的代码通过使用 `wrappedValue` 的 getter 和 setter 来获取这个值,但不能直接使用 `number`。有关 `private` 的更多信息,请参考 [访问控制](./25_Access_Control.md) +> 上面例子以 `private` 的方式声明 `number` 变量,这使得 `number` 仅在 `TwelveOrLess` 的实现中使用。写在其他地方的代码通过使用 `wrappedValue` 的 getter 和 setter 来获取这个值,但不能直接使用 `number`。有关 `private` 的更多信息,请参考 [访问控制](./26_Access_Control.md) 通过在属性之前写上包装器名称作为特性的方式,你可以把一个包装器应用到一个属性上去。这里有个存储小矩形的结构体。通过 `TwelveOrLess` 属性包装器实现类似(挺随意的)对“小”的定义。 diff --git a/source/02_language_guide/11_Methods.md b/source/02_language_guide/11_Methods.md index c785079a..25e98451 100755 --- a/source/02_language_guide/11_Methods.md +++ b/source/02_language_guide/11_Methods.md @@ -213,7 +213,7 @@ struct LevelTracker { 除了类型属性和类型方法,`LevelTracker` 还监测每个玩家的进度。它用实例属性 `currentLevel` 来监测每个玩家当前的等级。 -为了便于管理 `currentLevel` 属性,`LevelTracker` 定义了实例方法 `advance(to:)`。这个方法会在更新 `currentLevel` 之前检查所请求的新等级是否已经解锁。`advance(to:)` 方法返回布尔值以指示是否能够设置 `currentLevel`。因为允许在调用 `advance(to:)` 时候忽略返回值,不会产生编译警告,所以函数被标注为 `@discardableResult` 属性,更多关于属性信息,请参考 [特性](../03_language_reference/07_Attributes.html) 章节。 +为了便于管理 `currentLevel` 属性,`LevelTracker` 定义了实例方法 `advance(to:)`。这个方法会在更新 `currentLevel` 之前检查所请求的新等级是否已经解锁。`advance(to:)` 方法返回布尔值以指示是否能够设置 `currentLevel`。因为允许在调用 `advance(to:)` 时候忽略返回值,不会产生编译警告,所以函数被标注为 `@discardableResult` 属性,更多关于属性信息,请参考 [特性](../03_language_reference/07_Attributes.md) 章节。 下面,`Player` 类使用 `LevelTracker` 来监测和更新每个玩家的发展进度: diff --git a/source/02_language_guide/14_Initialization.md b/source/02_language_guide/14_Initialization.md index 17198ce1..f7dcf753 100755 --- a/source/02_language_guide/14_Initialization.md +++ b/source/02_language_guide/14_Initialization.md @@ -328,7 +328,7 @@ let centerRect = Rect(center: Point(x: 4.0, y: 4.0), > 注意 > -> 如果你想用另外一种不需要自己定义 `init()` 和 `init(origin:size:)` 的方式来实现这个例子,请参考 [扩展](./21_Extensions.md)。 +> 如果你想用另外一种不需要自己定义 `init()` 和 `init(origin:size:)` 的方式来实现这个例子,请参考 [扩展](./20_Extensions.md)。 ## 类的继承和构造过程 {#class-inheritance-and-initialization} diff --git a/source/02_language_guide/17_Error_Handling.md b/source/02_language_guide/17_Error_Handling.md index d637305f..f95496d2 100755 --- a/source/02_language_guide/17_Error_Handling.md +++ b/source/02_language_guide/17_Error_Handling.md @@ -149,7 +149,7 @@ do { } ``` -在 `catch` 后面写一个匹配模式来表明这个子句能处理什么样的错误。如果一条 `catch` 子句没有指定匹配模式,那么这条子句可以匹配任何错误,并且把错误绑定到一个名字为 `error` 的局部常量。关于模式匹配的更多信息请参考 [模式](../03_language_reference/07_Patterns.html)。 +在 `catch` 后面写一个匹配模式来表明这个子句能处理什么样的错误。如果一条 `catch` 子句没有指定匹配模式,那么这条子句可以匹配任何错误,并且把错误绑定到一个名字为 `error` 的局部常量。关于模式匹配的更多信息请参考 [模式](../03_language_reference/08_Patterns.md)。 举例来说,下面的代码处理了 `VendingMachineError` 枚举类型的全部三种情况: @@ -175,7 +175,7 @@ do { `catch` 子句不必将 `do` 子句中的代码所抛出的每一个可能的错误都作处理。如果所有 `catch` 子句都未处理错误,错误就会传递到周围的作用域。然而,错误还是必须要被某个周围的作用域处理的。在不会抛出错误的函数中,必须用 `do-catch` 语句处理错误。而能够抛出错误的函数既可以使用 `do-catch` 语句处理,也可以让调用方来处理错误。如果错误传递到了顶层作用域却依然没有被处理,你会得到一个运行时错误。 -以下面的代码为例,不是 `VendingMachineError` 中申明的错误会在调用函数的地方被捕获: +以下面的代码为例,不是 `VendingMachineError` 中声明的错误会在调用函数的地方被捕获: ```swift func nourish(with item: String) throws { diff --git a/source/02_language_guide/21_Protocols.md b/source/02_language_guide/21_Protocols.md index 6d780cbc..92f525f6 100644 --- a/source/02_language_guide/21_Protocols.md +++ b/source/02_language_guide/21_Protocols.md @@ -644,7 +644,7 @@ protocol SomeClassOnlyProtocol: AnyObject, SomeInheritedProtocol { > 注意 > -> 当协议定义的要求需要遵循协议的类型必须是引用语义而非值语义时,应该采用类类型专属协议。关于引用语义和值语义的更多内容,请查看 [结构体和枚举是值类型](./09_Classes_and_Structures.md#structures-and-enumerations-are-value-types) 和 [类是引用类型](./09-Classes-and-Structures.md#classes-are-reference-types)。 +> 当协议定义的要求需要遵循协议的类型必须是引用语义而非值语义时,应该采用类类型专属协议。关于引用语义和值语义的更多内容,请查看 [结构体和枚举是值类型](./09_Structures_And_Classes.md#structures-and-enumerations-are-value-types) 和 [类是引用类型](./09_Structures_And_Classes.md#classes-are-reference-types)。 ## 协议合成 {#protocol-composition} @@ -828,7 +828,7 @@ class Counter { 这里使用了两层可选链式调用。首先,由于 `dataSource` 可能为 `nil`,因此在 `dataSource` 后边加上了 `?`,以此表明只在 `dataSource` 非空时才去调用 `increment(forCount:)` 方法。其次,即使 `dataSource` 存在,也无法保证其是否实现了 `increment(forCount:)` 方法,因为这个方法是可选的。因此,`increment(forCount:)` 方法同样使用可选链式调用进行调用,只有在该方法被实现的情况下才能调用它,所以在 `increment(forCount:)` 方法后边也加上了 `?`。 -调用 `increment(forCount:)` 方法在上述两种情形下都有可能失败,所以返回值为 `Int?` 类型。虽然在 `CounterDataSource` 协议中,`increment(forCount:)` 的返回值类型是非可选 `Int`。另外,即使这里使用了两层可选链式调用,最后的返回结果依旧是单层的可选类型。关于这一点的更多信息,请查阅 [连接多层可选链式调用](./16_Optional_Chaining)。 +调用 `increment(forCount:)` 方法在上述两种情形下都有可能失败,所以返回值为 `Int?` 类型。虽然在 `CounterDataSource` 协议中,`increment(forCount:)` 的返回值类型是非可选 `Int`。另外,即使这里使用了两层可选链式调用,最后的返回结果依旧是单层的可选类型。关于这一点的更多信息,请查阅 [连接多层可选链式调用](./16_Optional_Chaining.md)。 在调用 `increment(forCount:)` 方法后,`Int?` 型的返回值通过可选绑定解包并赋值给常量 `amount`。如果可选值确实包含一个数值,也就是说,数据源和方法都存在,数据源方法返回了一个有效值。之后便将解包后的 `amount` 加到 `count` 上,增量操作完成。 diff --git a/source/02_language_guide/24_Automatic_Reference_Counting.md b/source/02_language_guide/24_Automatic_Reference_Counting.md index 85f8cb93..36dd7037 100755 --- a/source/02_language_guide/24_Automatic_Reference_Counting.md +++ b/source/02_language_guide/24_Automatic_Reference_Counting.md @@ -558,4 +558,4 @@ paragraph = nil // 打印“p is being deinitialized” ``` -你可以查看 [捕获列表](../03_language_reference/04_Expressions.html) 章节,获取更多关于捕获列表的信息。 +你可以查看 [捕获列表](../03_language_reference/04_Expressions.md) 章节,获取更多关于捕获列表的信息。 diff --git a/source/02_language_guide/27_Advanced_Operators.md b/source/02_language_guide/27_Advanced_Operators.md index fbfb5b42..44004482 100644 --- a/source/02_language_guide/27_Advanced_Operators.md +++ b/source/02_language_guide/27_Advanced_Operators.md @@ -438,7 +438,7 @@ let plusMinusVector = firstVector +- secondVector // plusMinusVector 是一个 Vector2D 实例,并且它的值为 (4.0, -2.0) ``` -这个运算符把两个向量的 `x` 值相加,同时从第一个向量的 `y` 中减去第二个向量的 `y` 。因为它本质上是属于“相加型”运算符,所以将它放置在 `+` 和 `-` 等默认中缀“相加型”运算符相同的优先级组中。关于 Swift 标准库提供的运算符,以及完整的运算符优先级组和结合性设置,请参考 [运算符声明](https://developer.apple.com/documentation/swift/operator_declarations)。而更多关于优先级组以及自定义操作符和优先级组的语法,请参考 [运算符声明](./06_Declarations.md#operator-declaration)。 +这个运算符把两个向量的 `x` 值相加,同时从第一个向量的 `y` 中减去第二个向量的 `y` 。因为它本质上是属于“相加型”运算符,所以将它放置在 `+` 和 `-` 等默认中缀“相加型”运算符相同的优先级组中。关于 Swift 标准库提供的运算符,以及完整的运算符优先级组和结合性设置,请参考 [运算符声明](https://developer.apple.com/documentation/swift/operator_declarations)。而更多关于优先级组以及自定义操作符和优先级组的语法,请参考 [运算符声明](../03_language_reference/06_Declarations.md#operator-declaration)。 > 注意 > diff --git a/source/03_language_reference/01_About_the_Language_Reference.md b/source/03_language_reference/01_About_the_Language_Reference.md index 21f27850..9375da6d 100755 --- a/source/03_language_reference/01_About_the_Language_Reference.md +++ b/source/03_language_reference/01_About_the_Language_Reference.md @@ -19,14 +19,14 @@ Swift 语言相对较小,这是由于 Swift 代码中常用的类型、函数 > getter-setter 方法块语法 > -> *getter-setter 方法块* → { [getter 子句](./06_Declarations.md#getter-clause) [setter 子句](./06-Declarations.md#setter-clause)可选 } | { [setter 子句](./06-Declarations.md#setter-clause) [getter 子句](./06-Declarations.md#getter-clause) } +> *getter-setter 方法块* → { [getter 子句](./06_Declarations.md#getter-clause) [setter 子句](./06_Declarations.md#setter-clause)可选 } | { [setter 子句](./06_Declarations.md#setter-clause) [getter 子句](./06_Declarations.md#getter-clause) } 这个定义表明,一个 getter-setter 方法块可以由一个 getter 分句后跟一个可选的 setter 分句构成,然后用大括号括起来,或者由一个 setter 分句后跟一个 getter 分句构成,然后用大括号括起来。上述的语法产式等价于下面的两个语法产式, : > getter-setter 方法块语法 > -> getter-setter 方法块 → { [getter 子句](./06_Declarations.md#getter-clause) [setter 子句](./06-Declarations.md#setter-clause)可选 } +> getter-setter 方法块 → { [getter 子句](./06_Declarations.md#getter-clause) [setter 子句](./06_Declarations.md#setter-clause)可选 } > -> getter-setter 方法块 → { [setter 子句](./06_Declarations.md#setter-clause) [getter 子句](./06-Declarations.md#getter-clause) } +> getter-setter 方法块 → { [setter 子句](./06_Declarations.md#setter-clause) [getter 子句](./06_Declarations.md#getter-clause) } > diff --git a/source/03_language_reference/03_Types.md b/source/03_language_reference/03_Types.md index 5fcf61b4..fc635217 100644 --- a/source/03_language_reference/03_Types.md +++ b/source/03_language_reference/03_Types.md @@ -80,7 +80,7 @@ var someValue: ExampleModule.MyType > #### type-identifier {#type-identifier} -> *类型标识符* → [类型名称](#type-name) [泛型实参子句](./09-Generic-Parameters-and-Arguments.md#generic-argument-clause)可选 | [类型名称](#type-name) [泛型实参子句](./09-Generic-Parameters-and-Arguments.md#generic-argument-clause)可选 **.** [类型标识符](#type-identifier) +> *类型标识符* → [类型名称](#type-name) [泛型实参子句](./09_Generic_Parameters_and_Arguments.md#generic-argument-clause)可选 | [类型名称](#type-name) [泛型实参子句](./09_Generic_Parameters_and_Arguments.md#generic-argument-clause)可选 **.** [类型标识符](#type-identifier) #### type-name {#type-name} > *类型名称* → [标识符](./02_Lexical_Structure.md#identifier) @@ -164,7 +164,7 @@ var operation: (Int, Int) -> Int // 正确 如果一个函数类型包涵多个箭头(->),那么函数类型将从右向左进行组合。例如,函数类型 `(Int) -> (Int) -> Int` 可以理解为 `(Int) -> ((Int) -> Int)`,也就是说,该函数传入 `Int`,并返回另一个传入并返回 `Int` 的函数。 -函数类型若要抛出或重抛错误就必须使用 `throws` 关键字来标记。`throws` 关键字是函数类型的一部分,非抛出函数是抛出函数的子类型。因此,在使用抛出函数的地方也可以使用不抛出函数。抛出和重抛函数的相关描述见章节 [抛出函数与方法](./06_Declarations.md#throwing-functions-and-methods) 和 [重抛函数与方法](./06-Declarations.md#rethrowing-functions-and-methods)。 +函数类型若要抛出或重抛错误就必须使用 `throws` 关键字来标记。`throws` 关键字是函数类型的一部分,非抛出函数是抛出函数的子类型。因此,在使用抛出函数的地方也可以使用不抛出函数。抛出和重抛函数的相关描述见章节 [抛出函数与方法](./06_Declarations.md#throwing-functions-and-methods) 和 [重抛函数与方法](./06_Declarations.md#rethrowing-functions-and-methods)。 ### 对非逃逸闭包的限制 {#Restrictions for Nonescaping Closures} 当非逃逸闭包函数是形参时,不能存储在属性、变量或任何 `Any` 类型的常量中,因为这可能导致值的逃逸。 @@ -202,7 +202,7 @@ func takesTwoFunctions(first: (Any) -> Void, second: (Any) -> Void) { > *函数类型子句* → **(** [函数类型实参列表](#function-type-argument-list) *...*­ 可选 **)** #### function-type-argument-list {#function-type-argument-list} -> *函数类型实参列表* → [函数类型实参](function-type-argument) | [函数类型实参](function-type-argument), [函数类型实参列表](#function-type-argument-list) +> *函数类型实参列表* → [函数类型实参](#function-type-argument) | [函数类型实参](#function-type-argument), [函数类型实参列表](#function-type-argument-list) #### function-type-argument {#function-type-argument} @@ -345,7 +345,7 @@ let implicitlyUnwrappedArray: [Int]! // 正确 > `Protocol 1` & `Procotol 2` -协议合成类型允许你指定一个值,其类型遵循多个协议的要求而不需要定义一个新的命名型协议来继承它想要符合的各个协议。比如,协议合成类型 `Protocol A & Protocol B & Protocol C` 等效于一个从 `Protocol A`,`Protocol B`,`Protocol C` 继承而来的新协议。同样的,你可以使用 `SuperClass & ProtocolA` 来取代申明一个新的协议作为 `SuperClass` 的子类并遵循 `ProtocolA`。 +协议合成类型允许你指定一个值,其类型遵循多个协议的要求而不需要定义一个新的命名型协议来继承它想要符合的各个协议。比如,协议合成类型 `Protocol A & Protocol B & Protocol C` 等效于一个从 `Protocol A`,`Protocol B`,`Protocol C` 继承而来的新协议。同样的,你可以使用 `SuperClass & ProtocolA` 来取代声明一个新的协议作为 `SuperClass` 的子类并遵循 `ProtocolA`。 协议合成列表中的每一项都必须是下面所列情况之一,列表中最多只能包含一个类: diff --git a/source/03_language_reference/04_Expressions.md b/source/03_language_reference/04_Expressions.md index f57b35e5..c96fbd1e 100644 --- a/source/03_language_reference/04_Expressions.md +++ b/source/03_language_reference/04_Expressions.md @@ -205,7 +205,7 @@ f(x as Any) > #### primary-expression {#primary-expression} -> *基本表达式* → [标识符](./02_Lexical_Structure.md#identifier) [泛型实参子句](./09-Generic-Parameters-and-Arguments.md#generic-argument-clause)可选 +> *基本表达式* → [标识符](./02_Lexical_Structure.md#identifier) [泛型实参子句](./09_Generic_Parameters_and_Arguments.md#generic-argument-clause)可选 > > *基本表达式* → [字面量表达式](#literal-expression) > @@ -469,7 +469,7 @@ myFunction { $0 + $1 } 使用闭包表达式时,可以不必将其存储在一个变量或常量中,例如作为函数调用的一部分来立即使用一个闭包。在上面的例子中,传入 `myFunction` 的闭包表达式就是这种立即使用类型的闭包。因此,一个闭包是否逃逸与其使用时的上下文相关。一个会被立即调用或者作为函数的非逃逸参数传递的闭包表达式是非逃逸的,否则,这个闭包表达式是逃逸的。 -关于逃逸闭包的内容,请参阅 [逃逸闭包](./02_language_guide/07_Closures.md#escaping-closures)。 +关于逃逸闭包的内容,请参阅 [逃逸闭包](../02_language_guide/07_Closures.md#escaping-closures)。 ## 捕获列表 {#capture-lists} 默认情况下,闭包会捕获附近作用域中的常量和变量,并使用强引用指向它们。你可以通过一个*捕获列表*来显式指定它的捕获行为。 @@ -527,7 +527,7 @@ myFunction { [unowned self] in print(self.title) } // 无主引用捕获 myFunction { [weak parent = self.parent] in print(parent!.title) } ``` -关于闭包表达式的更多信息和例子,请参阅 [闭包表达式](../02_language_guide/07_Closures.md#closure-expressions)。关于捕获列表的更多信息和例子,请参阅 [解决闭包引起的循环强引用](../02-language-guide/24-Automatic-Reference-Counting.md#resolving-strong-reference-cycles-for-closures)。 +关于闭包表达式的更多信息和例子,请参阅 [闭包表达式](../02_language_guide/07_Closures.md#closure-expressions)。关于捕获列表的更多信息和例子,请参阅 [解决闭包引起的循环强引用](../02_language_guide/24_Automatic_Reference_Counting.md#resolving-strong-reference-cycles-for-closures)。 > 闭包表达式语法 > @@ -542,13 +542,13 @@ myFunction { [weak parent = self.parent] in print(parent!.title) } #### closure-signature {#closure-signature} > > -> 闭包签名* → [参数子句](#parameter-clause) [函数结果](05-Declarations.md#function-result)可选 **in** +> 闭包签名* → [参数子句](#parameter-clause) [函数结果](./06_Declarations.md#function-result)可选 **in** > -> *闭包签名* → [标识符列表](#identifier-list) [函数结果](05-Declarations.md#function-result)可选 **in** +> *闭包签名* → [标识符列表](#identifier-list) [函数结果](./06_Declarations.md#function-result)可选 **in** > -> *闭包签名* → [捕获列表](#capture-list) [参数子句](05-Declarations.md#parameter-clause) [函数结果](./06-Declarations.md#function-result)可选 **in** +> *闭包签名* → [捕获列表](#capture-list) [参数子句](./06_Declarations.md#parameter-clause) [函数结果](./06_Declarations.md#function-result)可选 **in** > -> *闭包签名* → [捕获列表](#capture-list) [标识符列表](02-Lexical-Structure.md#identifier-list) [函数结果](./06-Declarations.md#function-result)可选 **in** +> *闭包签名* → [捕获列表](#capture-list) [标识符列表](./02_Lexical_Structure.md#identifier-list) [函数结果](./06_Declarations.md#function-result)可选 **in** > > *闭包签名* → [捕获列表](#capture-list) **in** > @@ -634,7 +634,7 @@ x = .AnotherValue > #### tuple-element {#tuple-element} -> *元组元素* → [表达式](#expression) | [标识符](identifier) **:** [表达式](#expression) +> *元组元素* → [表达式](#expression) | [标识符](#identifier) **:** [表达式](#expression) > ### 通配符表达式 {#wildcard-expression} @@ -939,7 +939,7 @@ print(keyPath == c.getSomeKeyPath()) 由于 key-path 字符串表达式在编译期才创建,编译期可以检查属性是否存在,以及属性是否暴露给 Objective-C 运行时。 -关于更多如何使用 key path 与 Objective-C APIs 交互的信息,请参阅 [在 Swift 中使用 Objective-C 运行时特性](./https://developer.apple.com/documentation/swift/using_objective_c_runtime_features_in_swift)。关于更多 key-value 编程和 key-value 观察的信息,请参阅 [Key-Value 编程](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/KeyValueCoding/index.md#//apple-ref/doc/uid/10000107i) 和 [Key-Value 观察编程](./https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.md#//apple-ref/doc/uid/10000177i)。 +关于更多如何使用 key path 与 Objective-C APIs 交互的信息,请参阅 [在 Swift 中使用 Objective-C 运行时特性](https://developer.apple.com/documentation/swift/using_objective_c_runtime_features_in_swift)。关于更多 key-value 编程和 key-value 观察的信息,请参阅 [Key-Value 编程](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/KeyValueCoding/index.md#//apple-ref/doc/uid/10000107i) 和 [Key-Value 观察编程](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.md#//apple-ref/doc/uid/10000177i)。 > 注意 > @@ -968,7 +968,7 @@ print(keyPath == c.getSomeKeyPath()) #### postfix-expression {#postfix-expression} > *后缀表达式* → [基本表达式](#primary-expression) > -> *后缀表达式* → [后缀表达式](#postfix-expression) [后缀运算符](02-Lexical-Structure.md#postfix-operator) +> *后缀表达式* → [后缀表达式](#postfix-expression) [后缀运算符](./02_Lexical_Structure.md#postfix-operator) > > *后缀表达式* → [函数调用表达式](#function-call-expression) > @@ -1041,9 +1041,9 @@ myData.someMethod {$0 == 13} > > #### function-call-argument {#function-call-argument} > -> *函数调用参数* → [表达式](#expression) | [标识符](02-Lexical-Structure.md#identifier) **:** [表达式](#expression) +> *函数调用参数* → [表达式](#expression) | [标识符](./02_Lexical_Structure.md#identifier) **:** [表达式](#expression) > -> *函数调用参数* → [运算符](./02_Lexical_Structure.md#operator) | [标识符](./02-Lexical-Structure.md#identifier) **:** [运算符](./02-Lexical-Structure.md#operator) +> *函数调用参数* → [运算符](./02_Lexical_Structure.md#operator) | [标识符](./02_Lexical_Structure.md#identifier) **:** [运算符](./02_Lexical_Structure.md#operator) > > #### trailing-closure {#trailing-closure} > @@ -1054,7 +1054,7 @@ myData.someMethod {$0 == 13} > *标签尾随闭包集* → [标签尾随闭包](#labeled-trailing-closure) [标签尾随闭包集](#labeled-trailing-closures)可选 > > #### labeled-trailing-closure {#labeled-trailing-closure} -> *标签尾随闭包* → [标识符](./02-Lexical-Structure.md#identifier) **:** [闭包表达式](#closure-expression) +> *标签尾随闭包* → [标识符](./02_Lexical_Structure.md#identifier) **:** [闭包表达式](#closure-expression) ### 构造器表达式 {#initializer-expression} @@ -1163,11 +1163,11 @@ let x = [10, 3, 20, 15, 4] > #### explicit-member-expression {#explicit-member-expression} -> *显式成员表达式* → [后缀表达式](#postfix-expression) **.** [十进制数字](02-Lexical-Structure.md#decimal-digit) +> *显式成员表达式* → [后缀表达式](#postfix-expression) **.** [十进制数字](./02_Lexical_Structure.md#decimal-digit) > -> *显式成员表达式* → [后缀表达式](#postfix-expression) **.** [标识符](02-Lexical-Structure.md#identifier) [泛型实参子句](./09-Generic-Parameters-and-Arguments.md#generic-argument-clause)可选
+> *显式成员表达式* → [后缀表达式](#postfix-expression) **.** [标识符](./02_Lexical_Structure.md#identifier) [泛型实参子句](./09_Generic_Parameters_and_Arguments.md#generic-argument-clause)可选
> -> *显式成员表达式* → [后缀表达式](#postfix-expression) **.** [标识符](02-Lexical-Structure.md#identifier) **(** [参数名称](#argument-names) **)** +> *显式成员表达式* → [后缀表达式](#postfix-expression) **.** [标识符](./02_Lexical_Structure.md#identifier) **(** [参数名称](#argument-names) **)** #### argument-names {#argument-names} > *参数名称* → [参数名](#argument-name) [参数名称](#argument-names)可选
diff --git a/source/03_language_reference/05_Statements.md b/source/03_language_reference/05_Statements.md index b2e0fdf3..30065de5 100755 --- a/source/03_language_reference/05_Statements.md +++ b/source/03_language_reference/05_Statements.md @@ -64,7 +64,7 @@ for item in collection { > #### for-in-statement {#for-in-statement} -> *for-in 语句* → **for** **case**可选 [模式](./08_Patterns.md#pattern) **in** [表达式](./04-Expressions.md#expression) [where 子句](#where-clause)可选 [代码块](05-Declarations.md#code-block) +> *for-in 语句* → **for** **case**可选 [模式](./08_Patterns.md#pattern) **in** [表达式](./04_Expressions.md#expression) [where 子句](#where-clause)可选 [代码块](./06_Declarations.md#code-block) > ### While 语句 {#while-statements} @@ -92,12 +92,12 @@ while condition { > #### while-statement {#while-statement} -> *while 语句* → **while** [条件子句](#condition-clause) [代码块](./05-Declarations.md#code-block) +> *while 语句* → **while** [条件子句](#condition-clause) [代码块](./06_Declarations.md#code-block) > #### condition-clause {#condition-clause} -> *条件子句* → [表达式](./04_Expressions.md#expression) | [表达式](./04-Expressions.md#expression) **,** [条件列表](#condition-list) +> *条件子句* → [表达式](./04_Expressions.md#expression) | [表达式](./04_Expressions.md#expression) **,** [条件列表](#condition-list) > #### condition {#condition} @@ -106,11 +106,11 @@ while condition { > #### case-condition {#case-condition} -> *case 条件* → **case** [模式](./08_Patterns.md#pattern) [构造器](./06-Declarations.md#initializer) +> *case 条件* → **case** [模式](./08_Patterns.md#pattern) [构造器](./06_Declarations.md#initializer) > #### optional-binding-condition {#optional-binding-condition} -> *可选绑定条件* → **let** [模式](./08_Patterns.md#pattern) [构造器](./06-Declarations.md#initializer) | **var** [模式](./08-Patterns.md#pattern) [构造器](./06-Declarations.md#initializer) +> *可选绑定条件* → **let** [模式](./08_Patterns.md#pattern) [构造器](./06_Declarations.md#initializer) | **var** [模式](./08_Patterns.md#pattern) [构造器](./06_Declarations.md#initializer) > ### Repeat-While 语句 {#repeat-while-statements} @@ -138,7 +138,7 @@ repeat { > #### repeat-while-statement {#repeat-while-statement} -> *repeat-while 语句* → **repeat** [代码块](./06_Declarations.md#code-block) **while** [表达式](./04-Expressions.md#expression) +> *repeat-while 语句* → **repeat** [代码块](./06_Declarations.md#code-block) **while** [表达式](./04_Expressions.md#expression) > ## 分支语句 {#branch-statements} @@ -200,7 +200,7 @@ if condition 1 { > #### if-statement {#if-statement} -> *if 语句* → **if** [条件子句](#condition-clause) [代码块](05-Declarations.md#code-block) [else 子句](#else-clause)可选 +> *if 语句* → **if** [条件子句](#condition-clause) [代码块](./06_Declarations.md#code-block) [else 子句](#else-clause)可选 > #### else-clause {#else-clause} @@ -228,14 +228,14 @@ guard condition else { * `continue` * `throw` -关于控制转移语句,请参阅 [控制转移语句](#control-transfer-statements)。关于 `Never` 返回类型的函数,请参阅 [永不返回的函数](05-Declarations.md#rethrowing-functions-and-methods)。 +关于控制转移语句,请参阅 [控制转移语句](#control-transfer-statements)。关于 `Never` 返回类型的函数,请参阅 [永不返回的函数](./06_Declarations.md#rethrowing-functions-and-methods)。 > guard 语句语法 > > #### guard-statement {#guard-statement} -> *guard 语句* → **guard** [条件子句](#condition-clause) **else** [代码块](05-Declarations.md#code-block) +> *guard 语句* → **guard** [条件子句](#condition-clause) **else** [代码块](./06_Declarations.md#code-block) ### Switch 语句 {#switch-statements} @@ -325,7 +325,7 @@ case .suppressed: > #### case-item-list {#case-item-list} -> *case 项列表* → [模式](./08_Patterns.md#pattern) [where 子句](#where-clause)可选 | [模式](07-Patterns.md#pattern) [where 子句](#where-clause)可选 **,** [case 项列表](#case-item-list) +> *case 项列表* → [模式](./08_Patterns.md#pattern) [where 子句](#where-clause)可选 | [模式](./08_Patterns.md#pattern) [where 子句](#where-clause)可选 **,** [case 项列表](#case-item-list) > #### default-label {#default-label} @@ -424,7 +424,7 @@ case .suppressed: 无论哪种情况,控制权都会被转移给被终止的控制流语句后面的第一行语句。 -关于使用 `break` 语句的例子,请参阅 [控制流](../02_language_guide/05_Control_Flow.md) 一章的 [Break](../02_language_guide/05_Control_Flow.md#break) 和 [带标签的语句](../02-language-guide/05-Control-Flow.md#labeled-statements)。 +关于使用 `break` 语句的例子,请参阅 [控制流](../02_language_guide/05_Control_Flow.md) 一章的 [Break](../02_language_guide/05_Control_Flow.md#break) 和 [带标签的语句](../02_language_guide/05_Control_Flow.md#labeled-statements)。 > break 语句语法 > @@ -450,7 +450,7 @@ case .suppressed: 在 `for` 语句中,`continue` 语句执行后,增量表达式还是会被计算,这是因为每次循环体执行完毕后,增量表达式都会被计算。 -关于使用 `continue` 语句的例子,请参阅 [控制流](../02_language_guide/05_Control_Flow.md) 一章的 [Continue](../02_language_guide/05_Control_Flow.md#continue) 和 [带标签的语句](../02-language-guide/05-Control-Flow.md#labeled-statements)。 +关于使用 `continue` 语句的例子,请参阅 [控制流](../02_language_guide/05_Control_Flow.md) 一章的 [Continue](../02_language_guide/05_Control_Flow.md#continue) 和 [带标签的语句](../02_language_guide/05_Control_Flow.md#labeled-statements)。 > continue 语句语法 > @@ -500,7 +500,7 @@ case .suppressed: > #### return-statement {#return-statement} -> *return 语句* → **return** [表达式](./04_Expressions.html#expression)可选 +> *return 语句* → **return** [表达式](./04_Expressions.md#expression)可选 ### Throw 语句 {#throw-statements} @@ -607,13 +607,13 @@ do { > #### catch-clause {#catch-clause} -> *catch 子句* → **catch** [模式](./08_Patterns.md#pattern)可选 [where 子句](#where-clause)可选 [代码块](05-Declarations.md#code-block) +> *catch 子句* → **catch** [模式](./08_Patterns.md#pattern)可选 [where 子句](#where-clause)可选 [代码块](./06_Declarations.md#code-block) #### catch-pattern-list{#catch-pattern-list} > *catch 模式列表* → [catch 模式](#catch-pattern) | [catch 模式](#catch-pattern) ,[catch 模式列表](#catch-pattern-list) #### catch-pattern{#catch-pattern} -> *catch 模式* → [模式](./08_Patterns.md#pattern) [where 子句](./05-Statements.md#where-clause)可选 +> *catch 模式* → [模式](./08_Patterns.md#pattern) [where 子句](./05_Statements.md#where-clause)可选 ## 编译器控制语句 {#compiler-control-statements} 编译器控制语句允许程序改变编译器的行为。Swift 有三种编译器控制语句:条件编译语句、线路控制语句和编译时诊断语句。 @@ -898,6 +898,6 @@ if #available(platform name version, ..., *) { #### platform-version {#platform-version} > *平台版本* → [十进制数字](./02_Lexical_Structure.md#decimal-digits) > -> *平台版本* → [十进制数字](./02_Lexical_Structure.md#decimal-digits) **.** [十进制数字](./02-Lexical-Structure.md#decimal-digits) +> *平台版本* → [十进制数字](./02_Lexical_Structure.md#decimal-digits) **.** [十进制数字](./02_Lexical_Structure.md#decimal-digits) > -> *平台版本* → [十进制数字](./02_Lexical_Structure.md#decimal-digits) **.** [十进制数字](./02-Lexical-Structure.md#decimal-digits) **.** [十进制数字](./02-Lexical-Structure.md#decimal-digits) +> *平台版本* → [十进制数字](./02_Lexical_Structure.md#decimal-digits) **.** [十进制数字](./02_Lexical_Structure.md#decimal-digits) **.** [十进制数字](./02_Lexical_Structure.md#decimal-digits) diff --git a/source/03_language_reference/06_Declarations.md b/source/03_language_reference/06_Declarations.md index d0ea62ad..2b4b661f 100755 --- a/source/03_language_reference/06_Declarations.md +++ b/source/03_language_reference/06_Declarations.md @@ -106,7 +106,7 @@ import 模块.子模块 > #### import-path-identifier {#import-path-identifier} > -> *导入路径标识符* → [标识符](./02_Lexical_Structure.md#identifier) | [运算符](./02-Lexical-Structure.md#operator) +> *导入路径标识符* → [标识符](./02_Lexical_Structure.md#identifier) | [运算符](./02_Lexical_Structure.md#operator) > ## 常量声明 {#constant-declaration} @@ -139,7 +139,7 @@ print("The second number is \(secondNumber).") 声明一个常量类型属性要使用 `static` 声明修饰符。类的常量类型属性总是隐式地被标记为 `final` ;你无法用 `class` 或 `final` 声明修饰符实现允许或禁止被子类重写的目的。类型属性在 [类型属性](../02_language_guide/10_Properties.md#type-properties) 中有介绍。 -如果还想获得更多关于常量的信息或者想在使用中获得帮助,请参阅 [常量和变量](../02_language_guide/01_The_Basics.md#constants-and-variables) 和 [存储属性](../02-language-guide/10-Properties.md#stored-properties)。 +如果还想获得更多关于常量的信息或者想在使用中获得帮助,请参阅 [常量和变量](../02_language_guide/01_The_Basics.md#constants-and-variables) 和 [存储属性](../02_language_guide/10_Properties.md#stored-properties)。 #### grammer-of-a-constant-declaration {#grammer-of-a-constant-declaration} @@ -148,7 +148,7 @@ print("The second number is \(secondNumber).") > #### constant-declaration {#constant-declaration} > -> *常量声明* → [特性列表](./07_Attributes.md#attributes)可选 [声明修饰符列表](#declaration-modifiers)可选 **let** [模式构造器列表](pattern-initializer-list) +> *常量声明* → [特性列表](./07_Attributes.md#attributes)可选 [声明修饰符列表](#declaration-modifiers)可选 **let** [模式构造器列表](#pattern-initializer-list) > > #### pattern-initializer-list {#pattern-initializer-list} @@ -259,15 +259,15 @@ var 变量名称: 类型 = 表达式 { #### variable-declaration {#variable-declaration} > *变量声明* → [变量声明头](#variable-declaration-head) [模式构造器列表](#pattern-initializer-list) > -> *变量声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [类型注解](03-Types.md#type-annotation) [代码块](#code-block) +> *变量声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [类型注解](./03_Types.md#type-annotation) [代码块](#code-block) > -> *变量声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [类型注解](03-Types.md#type-annotation) [getter-setter 代码块](#getter-setter-block) +> *变量声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [类型注解](./03_Types.md#type-annotation) [getter-setter 代码块](#getter-setter-block) > -> *变量声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [类型注解](03-Types.md#type-annotation) [getter-setter 关键字代码块](#getter-setter-keyword-block) +> *变量声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [类型注解](./03_Types.md#type-annotation) [getter-setter 关键字代码块](#getter-setter-keyword-block) > > *变量声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [构造器](#initializer) [willSet-didSet 代码块](#willSet-didSet-block) > -> *变量声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [类型注解](03-Types.md#type-annotation) [构造器](#initializer)可选 [willSet-didSet 代码块](#willSet-didSet-block) +> *变量声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [类型注解](./03_Types.md#type-annotation) [构造器](#initializer)可选 [willSet-didSet 代码块](#willSet-didSet-block) > @@ -479,7 +479,7 @@ repeatGreeting("Hello, world!", count: 2) // count 有标签, greeting 没有 不能将同一个值传递给多个输入输出参数,因为这种情况下的拷贝与覆盖行为的顺序是不确定的,因此原始值的最终值也将无法确定。 -更多关于内存安全和内存独占权的讨论,请参阅 [内存安全](../02_language_guide/24_MemorySafety.md)。 +更多关于内存安全和内存独占权的讨论,请参阅 [内存安全](../02_language_guide/24_Memory_Safety.md)。 如果一个闭包或者嵌套函数捕获了一个输入输出参数,那么这个闭包或者嵌套函数必须是非逃逸的。如果你需要捕获一个输入输出参数,但并不对其进行修改或者在其他代码中观察其值变化,那么你可以使用捕获列表来显式地表明这是个不可变捕获。 @@ -627,7 +627,7 @@ Swift 定义了 `Never` 类型,它表示函数或者方法不会返回给它 > #### function-declaration {#function-declaration} -> *函数声明* → [函数头](#function-head) [函数名](#function-name) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [函数签名](#function-signature) [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause) [函数体](#function-body)可选 +> *函数声明* → [函数头](#function-head) [函数名](#function-name) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [函数签名](#function-signature) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause) [函数体](#function-body)可选 > @@ -637,7 +637,7 @@ Swift 定义了 `Never` 类型,它表示函数或者方法不会返回给它 > #### function-name {#function-name} > -> *函数名* → [标识符](./02_Lexical_Structure.md#identifier) | [运算符](./02-Lexical-Structure.md#operator) +> *函数名* → [标识符](./02_Lexical_Structure.md#identifier) | [运算符](./02_Lexical_Structure.md#operator) > > > @@ -651,7 +651,7 @@ Swift 定义了 `Never` 类型,它表示函数或者方法不会返回给它 > #### function-result {#function-result} > -> *函数结果* → **->** [特性列表](./07_Attributes.md#attributes)可选 [类型](./03-Types.md#type) +> *函数结果* → **->** [特性列表](./07_Attributes.md#attributes)可选 [类型](./03_Types.md#type) > > #### function-body {#function-body} @@ -672,11 +672,11 @@ Swift 定义了 `Never` 类型,它表示函数或者方法不会返回给它 > #### parameter {#parameter} > -> *参数* → [外部参数名](#external-parameter-name)可选 [内部参数名](#local-parameter-name) [类型注解](03-Types.md#type-annotation) [默认参数子句](#default-argument-clause)可选 +> *参数* → [外部参数名](#external-parameter-name)可选 [内部参数名](#local-parameter-name) [类型注解](./03_Types.md#type-annotation) [默认参数子句](#default-argument-clause)可选 > -> *参数* → [外部参数名](#external-parameter-name)可选 [内部参数名](#local-parameter-name) [类型注解](03-Types.md#type-annotation) +> *参数* → [外部参数名](#external-parameter-name)可选 [内部参数名](#local-parameter-name) [类型注解](./03_Types.md#type-annotation) > -> *参数* → [外部参数名](#external-parameter-name)可选 [内部参数名](#local-parameter-name) [类型注解](03-Types.md#type-annotation) **...** +> *参数* → [外部参数名](#external-parameter-name)可选 [内部参数名](#local-parameter-name) [类型注解](./03_Types.md#type-annotation) **...** > > #### external-parameter-name {#external-parameter-name} @@ -789,9 +789,9 @@ enum GamePlayMode: String { 枚举用例具有原始值的枚举类型隐式地符合定义在 Swift 标准库中的 `RawRepresentable` 协议。所以,它们拥有一个 `rawValue` 属性和一个可失败构造器 `init?(rawValue: RawValue)`。可以使用 `rawValue` 属性去获取枚举用例的原始值,例如 `ExampleEnum.b.rawValue`。还可以根据原始值来创建一个相对应的枚举用例,只需调用枚举的可失败构造器,例如 `ExampleEnum(rawValue: 5)`,这个可失败构造器返回一个可选类型的用例。要获得更多关于具有原始值的枚举用例的信息和例子,请参阅 [原始值](../02_language_guide/08_Enumerations.md#raw-values)。 ### 访问枚举用例 {#accessing-enumeration-cases} -使用点语法(`.`)来引用枚举类型的枚举用例,例如 `EnumerationType.enumerationCase`。当枚举类型可以由上下文推断而出时,可以省略它(但是 `.` 仍然需要),正如 [枚举语法](../02_language_guide/08_Enumerations.md#enumeration-syntax) 和 [显式成员表达式](./04-Expressions.md#explicit-member-expression) 所述。 +使用点语法(`.`)来引用枚举类型的枚举用例,例如 `EnumerationType.enumerationCase`。当枚举类型可以由上下文推断而出时,可以省略它(但是 `.` 仍然需要),正如 [枚举语法](../02_language_guide/08_Enumerations.md#enumeration-syntax) 和 [显式成员表达式](./04_Expressions.md#explicit-member-expression) 所述。 -可以使用 `switch` 语句来检验枚举用例的值,正如 [使用 switch 语句匹配枚举值](../02_language_guide/08_Enumerations.md#matching-enumeration-values-with-a-switch-statement) 所述。枚举类型是模式匹配的,依靠 `switch` 语句 `case` 块中的枚举用例模式,正如 [枚举用例模式](./08-Patterns.md#enumeration-case-pattern) 所述。 +可以使用 `switch` 语句来检验枚举用例的值,正如 [使用 switch 语句匹配枚举值](../02_language_guide/08_Enumerations.md#matching-enumeration-values-with-a-switch-statement) 所述。枚举类型是模式匹配的,依靠 `switch` 语句 `case` 块中的枚举用例模式,正如 [枚举用例模式](./08_Patterns.md#enumeration-case-pattern) 所述。 #### grammer-of-an-enumeration-declaration {#grammer-of-an-enumeration-declaration} @@ -806,7 +806,7 @@ enum GamePlayMode: String { > *枚举声明* → [特性列表](./07_Attributes.md#attributes)可选 [访问级别修饰符](#access-level-modifier) 可选 [原始值风格枚举](#raw-value-style-enum) > > -> *联合风格枚举* → **indirect**可选 **enum** [枚举名称](#enum-name) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03-Types.md#type-inheritance-clause)可选 **{** [多个联合风格枚举成员](#union-style-enum-members)可选 **}** +> *联合风格枚举* → **indirect**可选 **enum** [枚举名称](#enum-name) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03_Types.md#type-inheritance-clause)可选 **{** [多个联合风格枚举成员](#union-style-enum-members)可选 **}** > > #### union-style-enum-members {#union-style-enum-members} @@ -816,7 +816,7 @@ enum GamePlayMode: String { > #### union-style-enum-member {#union-style-enum-member} > -> *联合风格枚举成员* → [声明](#declaration) | [联合风格枚举用例子句](#union-style-enum-case-clause) | [编译控制流语句](05-Statements.md#compiler-control-statement) +> *联合风格枚举成员* → [声明](#declaration) | [联合风格枚举用例子句](#union-style-enum-case-clause) | [编译控制流语句](./05_Statements.md#compiler-control-statement) > > #### union-style-enum-case-clause {#union-style-enum-case-clause} @@ -831,7 +831,7 @@ enum GamePlayMode: String { > #### union-style-enum-case {#union-style-enum-case} > -> *联合风格枚举用例* → [枚举用例名称](#enum-case-name) [元组类型](03-Types.md#tuple-type)可选 +> *联合风格枚举用例* → [枚举用例名称](#enum-case-name) [元组类型](./03_Types.md#tuple-type)可选 > > #### enum-name {#enum-name} @@ -847,7 +847,7 @@ enum GamePlayMode: String { > #### raw-value-style-enum {#raw-value-style-enum} > > -> *原始值风格枚举* → **enum** [枚举名称](#enum-name) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03-Types.md#type-inheritance-clause) [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause) **{** [多个原始值风格枚举成员](#raw-value-style-enum-members) **}** +> *原始值风格枚举* → **enum** [枚举名称](#enum-name) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03_Types.md#type-inheritance-clause) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause) **{** [多个原始值风格枚举成员](#raw-value-style-enum-members) **}** > > #### raw-value-style-enum-members {#raw-value-style-enum-members} @@ -857,7 +857,7 @@ enum GamePlayMode: String { > #### raw-value-style-enum-member {#raw-value-style-enum-member} > -> *原始值风格枚举成员* → [声明](#declaration) | [原始值风格枚举用例子句](#raw-value-style-enum-case-clause) | [编译控制流语句](05-Statements.md#compiler-control-statement) +> *原始值风格枚举成员* → [声明](#declaration) | [原始值风格枚举用例子句](#raw-value-style-enum-case-clause) | [编译控制流语句](./05_Statements.md#compiler-control-statement) > > #### raw-value-style-enum-case-clause {#raw-value-style-enum-case-clause} @@ -882,7 +882,7 @@ enum GamePlayMode: String { > #### raw-value-literal {#raw-value-literal} > -> *原始值字面量* → [数字型字面量](./02_Lexical_Structure.md#numeric-literal) | [字符串型字面量](./02-Lexical-Structure.md#static-string-literal) | [布尔型字面量](./02-Lexical-Structure.md#boolean-literal) +> *原始值字面量* → [数字型字面量](./02_Lexical_Structure.md#numeric-literal) | [字符串型字面量](./02_Lexical_Structure.md#static-string-literal) | [布尔型字面量](./02_Lexical_Structure.md#boolean-literal) > ## 结构体声明 {#structure-declaration} @@ -923,7 +923,7 @@ struct 结构体名称: 采纳的协议 { > #### struct-declaration {#struct-declaration} > -> *结构体声明* → [特性列表](./07_Attributes.md#attributes)可选 [访问级别修饰符](#access-level-modifier) 可选 **struct** [结构体名称](#struct-name) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03-Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [结构体主体](#struct-body) +> *结构体声明* → [特性列表](./07_Attributes.md#attributes)可选 [访问级别修饰符](#access-level-modifier) 可选 **struct** [结构体名称](#struct-name) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03_Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [结构体主体](#struct-body) > > #### struct-name {#struct-name} @@ -944,7 +944,7 @@ struct 结构体名称: 采纳的协议 { > #### struct-member {#struct-member} > -> *结构体成员* → [声明](#declaration) | [编译控制流语句](05-Statements.md#compiler-control-statement) +> *结构体成员* → [声明](#declaration) | [编译控制流语句](./05_Statements.md#compiler-control-statement) > ## 类声明 {#class-declaration} @@ -988,9 +988,9 @@ class 类名: 超类, 采纳的协议 { > #### class-declaration {#class-declaration} > -> *类声明* → [特性列表](./07_Attributes.md#attributes)可选 [访问级别修饰符](#access-level-modifier)可选 **final**可选 **class** [类名](#class-name) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03-Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [类主体](#class-body) +> *类声明* → [特性列表](./07_Attributes.md#attributes)可选 [访问级别修饰符](#access-level-modifier)可选 **final**可选 **class** [类名](#class-name) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03_Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [类主体](#class-body) > -> *类声明* → [特性列表](./07_Attributes.md#attributes)可选 **final** [访问级别修饰符](#access-level-modifier)可选 **class** [类名](#class-name) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03-Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [类主体](#class-body) +> *类声明* → [特性列表](./07_Attributes.md#attributes)可选 **final** [访问级别修饰符](#access-level-modifier)可选 **class** [类名](#class-name) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03_Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [类主体](#class-body) > > #### class-name {#class-name} @@ -1008,7 +1008,7 @@ class 类名: 超类, 采纳的协议 { > #### class-member {#class-member} > -> *类成员* → [声明](#declaration) | [编译控制流语句](05-Statements.md#compiler-control-statement) +> *类成员* → [声明](#declaration) | [编译控制流语句](./05_Statements.md#compiler-control-statement) > ## 协议声明 {#protocol-declaration} @@ -1026,7 +1026,8 @@ protocol 协议名称: 继承的协议 { > 注意 > -> 也可以使用协议合成类型来聚合多个协议的一致性要求,请参阅 [协议合成类型](./03_Types.md#protocol-composition-type) 和 [协议合成](../02-language-guide/21-Protocols.md#protocol-composition)。 +> 也可以使用协议合成类型来聚合多个协议的一致性要求,请参阅 [协议合成类型](./03_Types.md#protocol-composition-type) 和 [协议合成](../02_language_guide/21 +_Protocols.md#protocol-composition)。 > 可以通过类型的扩展声明来采纳协议,从而为之前声明的类型添加协议一致性。在扩展中,必须实现所有采纳协议的要求。如果该类型已经实现了所有的要求,可以让这个扩展声明的主体留空。 @@ -1060,7 +1061,7 @@ protocol SomeProtocol: AnyObject { > #### protocol-declaration {#protocol-declaration} > -> *协议声明* → [特性列表](./07_Attributes.md#attributes)可选 [访问级别修饰符](#access-level-modifier)可选 **protocol** [协议名称](#protocol-name) [类型继承子句](03-Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [协议主体](#protocol-body) +> *协议声明* → [特性列表](./07_Attributes.md#attributes)可选 [访问级别修饰符](#access-level-modifier)可选 **protocol** [协议名称](#protocol-name) [类型继承子句](./03_Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [协议主体](#protocol-body) > > #### protocol-name {#protocol-name} @@ -1078,7 +1079,7 @@ protocol SomeProtocol: AnyObject { > #### protocol-member {#protocol-member} > -> *协议成员* → [协议成员声明](#protocol-member-declaration) | [编译控制流语句](05-Statements.md#compiler-control-statement) +> *协议成员* → [协议成员声明](#protocol-member-declaration) | [编译控制流语句](./05_Statements.md#compiler-control-statement) > > > @@ -1122,7 +1123,7 @@ var 属性名: 类型 { get set } > #### protocol-property-declaration {#protocol-property-declaration} > -> *协议属性声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [类型注解](03-Types.md#type-annotation) [getter-setter 关键字代码块](#getter-setter-keyword-block) +> *协议属性声明* → [变量声明头](#variable-declaration-head) [变量名称](#variable-name) [类型注解](./03_Types.md#type-annotation) [getter-setter 关键字代码块](#getter-setter-keyword-block) > ### 协议方法声明 {#protocol-method-declaration} @@ -1139,7 +1140,7 @@ var 属性名: 类型 { get set } > #### protocol-method-declaration {#protocol-method-declaration} > -> *协议方法声明* → [函数头](#function-head) [函数名](#function-name) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [函数签名](#function-signature) [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 +> *协议方法声明* → [函数头](#function-head) [函数名](#function-name) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [函数签名](#function-signature) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 > ### 协议构造器声明 {#protocol-initializer-declaration} @@ -1159,9 +1160,9 @@ var 属性名: 类型 { get set } > #### protocol-initializer-declaration {#protocol-initializer-declaration} > -> *协议构造器声明* → [构造器头](#initializer-head) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [参数子句](#parameter-clause) **throws**可选 [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 +> *协议构造器声明* → [构造器头](#initializer-head) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [参数子句](#parameter-clause) **throws**可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 > -> *协议构造器声明* → [构造器头](#initializer-head) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [参数子句](#parameter-clause) **rethrows** [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 +> *协议构造器声明* → [构造器头](#initializer-head) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [参数子句](#parameter-clause) **rethrows** [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 > ### 协议下标声明 {#protocol-subscript-declaration} @@ -1184,7 +1185,7 @@ subscript (参数列表) -> 返回类型 { get set } > #### protocol-subscript-declaration {#protocol-subscript-declaration} > -> *协议下标声明* → [下标头](#subscript-head) [下标结果](#subscript-result) [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [getter-setter 关键字代码块](#getter-setter-keyword-block) +> *协议下标声明* → [下标头](#subscript-head) [下标结果](#subscript-result) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [getter-setter 关键字代码块](#getter-setter-keyword-block) > ### 协议关联类型声明 {#protocol-associated-type-declaration} @@ -1217,7 +1218,7 @@ protocol SubProtocolB: SomeProtocol where SomeType: Equatable { } > #### protocol-associated-type-declaration {#protocol-associated-type-declaration} > -> *协议关联类型声明* → [特性列表](./07_Attributes.md#attributes)可选 [访问级别修饰符](#access-level-modifier)可选 **associatedtype** [类型别名头](#typealias-head) [类型继承子句](03-Types.md#type-inheritance-clause)可选 [类型别名赋值](#typealias-assignment)可选 [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 +> *协议关联类型声明* → [特性列表](./07_Attributes.md#attributes)可选 [访问级别修饰符](#access-level-modifier)可选 **associatedtype** [类型别名头](#typealias-head) [类型继承子句](./03_Types.md#type-inheritance-clause)可选 [类型别名赋值](#typealias-assignment)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 ## 构造器声明 {#initializer-declaration} @@ -1310,9 +1311,9 @@ if let actualInstance = SomeStruct(input: "Hello") { > #### initializer-declaration {#initializer-declaration} > -> *构造器声明* → [构造器头](#initializer-head) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [参数子句](#parameter-clause) **throws**可选 [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [构造器主体](#initializer-body) +> *构造器声明* → [构造器头](#initializer-head) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [参数子句](#parameter-clause) **throws**可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [构造器主体](#initializer-body) > -> *构造器声明* → [构造器头](#initializer-head) [泛型形参子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [参数子句](#parameter-clause) **rethrows**可选 [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [构造器主体](#initializer-body) +> *构造器声明* → [构造器头](#initializer-head) [泛型形参子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [参数子句](#parameter-clause) **rethrows**可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [构造器主体](#initializer-body) > > #### initializer-head {#initializer-head} @@ -1537,7 +1538,7 @@ extension Array: Loggable where Element: MarkedLoggable { } > #### extension-declaration {#extension-declaration} > -> *扩展声明* → [特性](./07_Attributes.md#type-attributes)可选 [访问级别修饰符](#access-level-modifier)可选 **extension** [类型标识符](03-Types.md#type-identifier) [类型-继承-子句](./03-Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [扩展主体](#extension-body) +> *扩展声明* → [特性](./07_Attributes.md#type-attributes)可选 [访问级别修饰符](#access-level-modifier)可选 **extension** [类型标识符](./03_Types.md#type-identifier) [类型-继承-子句](./03_Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [扩展主体](#extension-body) > > #### extension-body {#extension-body} @@ -1546,7 +1547,7 @@ extension Array: Loggable where Element: MarkedLoggable { } > > *多条声明* → [单条声明](#subscript-declaration) [多条声明](#declarations) 可选 > -> *单条声明* → [声明语句](#declarations) | [编译控制流语句](05-Statements.md#compiler-control-statement) +> *单条声明* → [声明语句](#declarations) | [编译控制流语句](./05_Statements.md#compiler-control-statement) > ## 下标声明 {#subscript-declaration} @@ -1592,21 +1593,21 @@ subscript (参数列表) -> 返回类型 { > #### subscript-declaration {#subscript-declaration} > -> *下标声明* → [下标头](#subscript-head) [下标结果](#subscript-result) [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [代码块](#code-block) +> *下标声明* → [下标头](#subscript-head) [下标结果](#subscript-result) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [代码块](#code-block) > -> *下标声明* → [下标头](#subscript-head) [下标结果](#subscript-result) [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [getter-setter 代码块](#getter-setter-block) +> *下标声明* → [下标头](#subscript-head) [下标结果](#subscript-result) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [getter-setter 代码块](#getter-setter-block) > -> *下标声明* → [下标头](#subscript-head) [下标结果](#subscript-result) [泛型 where 子句](08-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [getter-setter 关键字代码块](#getter-setter-keyword-block) +> *下标声明* → [下标头](#subscript-head) [下标结果](#subscript-result) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [getter-setter 关键字代码块](#getter-setter-keyword-block) > > #### subscript-head {#subscript-head} > -> *下标头* → [特性列表](./07_Attributes.md#attributes)可选 [声明修饰符列表](#declaration-modifiers)可选 **subscript** [泛型参数子句](08-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [参数子句](#parameter-clause) +> *下标头* → [特性列表](./07_Attributes.md#attributes)可选 [声明修饰符列表](#declaration-modifiers)可选 **subscript** [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [参数子句](#parameter-clause) > > #### subscript-result {#subscript-result} > -> *下标结果* → **->** [特性列表](./07_Attributes.md#attributes)可选 [类型](./03-Types.md#type) +> *下标结果* → **->** [特性列表](./07_Attributes.md#attributes)可选 [类型](./03_Types.md#type) > ## 运算符声明 {#operator-declaration} @@ -1663,7 +1664,7 @@ postfix operator 运算符名称 {} > #### postfix-operator-declaration {#postfix-operator-declaration} > -> *后缀运算符声明* → **postfix** **运算符** [运算符](./02_Lexical_Structure.html#operator) **{** **}** +> *后缀运算符声明* → **postfix** **运算符** [运算符](./02_Lexical_Structure.md#operator) **{** **}** > > #### infix-operator-declaration {#infix-operator-declaration} diff --git a/source/03_language_reference/07_Attributes.md b/source/03_language_reference/07_Attributes.md index 507187b5..eca0766e 100755 --- a/source/03_language_reference/07_Attributes.md +++ b/source/03_language_reference/07_Attributes.md @@ -433,7 +433,7 @@ Interface Builder 特性是 Interface Builder 用来与 Xcode 同步的声明特 ### `autoclosure` {#autoclosure} -这个特性通过把表达式自动封装成无参数的闭包来延迟表达式的计算。它可以修饰类型为返回表达式结果类型的无参数函数类型的函数参数。关于如何使用 `autoclosure` 特性的例子,请参阅 [自动闭包](../02_language_guide/07_Closures.md#autoclosures) 和 [函数类型](./03-Types.md#function-type)。 +这个特性通过把表达式自动封装成无参数的闭包来延迟表达式的计算。它可以修饰类型为返回表达式结果类型的无参数函数类型的函数参数。关于如何使用 `autoclosure` 特性的例子,请参阅 [自动闭包](../02_language_guide/07_Closures.md#autoclosures) 和 [函数类型](./03_Types.md#function-type)。 ### `convention` {#convention} diff --git a/source/03_language_reference/08_Patterns.md b/source/03_language_reference/08_Patterns.md index 9a39405a..4b2a0436 100755 --- a/source/03_language_reference/08_Patterns.md +++ b/source/03_language_reference/08_Patterns.md @@ -12,13 +12,13 @@ Swift 中的模式分为两类:一种能成功匹配任何类型的值,另 > #### pattern {#pattern} -> *模式* → [通配符模式](#wildcard-pattern) [类型注解](03-Types.md#type-annotation)可选 +> *模式* → [通配符模式](#wildcard-pattern) [类型注解](./03_Types.md#type-annotation)可选 > -> *模式* → [标识符模式](#identifier-pattern) [类型注解](03-Types.md#type-annotation)可选 +> *模式* → [标识符模式](#identifier-pattern) [类型注解](./03_Types.md#type-annotation)可选 > > *模式* → [值绑定模式](#value-binding-pattern) > -> *模式* → [元组模式](#tuple-pattern) [类型注解](03-Types.md#type-annotation)可选 +> *模式* → [元组模式](#tuple-pattern) [类型注解](./03_Types.md#type-annotation)可选 > > *模式* → [枚举用例模式](#enum-case-pattern) > @@ -145,7 +145,7 @@ case nil: > 枚举用例模式语法 > > #### enum-case-pattern {#enum-case-pattern} -> *枚举用例模式* → [类型标识](./03_Types.md#type-identifier)可选 **.** [枚举用例名](./06-Declarations.md#enum-case-name) [元组模式](#tuple-pattern)可选 +> *枚举用例模式* → [类型标识](./03_Types.md#type-identifier)可选 **.** [枚举用例名](./06_Declarations.md#enum-case-name) [元组模式](#tuple-pattern)可选 > ## 可选模式(Optional Pattern) {#optional-pattern} @@ -208,7 +208,7 @@ for case let number? in arrayOfOptinalInts { > *is 模式* → **is** [类型](./03_Types.md#type) > > #### as-pattern {#as-pattern} -> *as 模式* → [模式](#pattern) **as** [类型](03-Types.md#type) +> *as 模式* → [模式](#pattern) **as** [类型](./03_Types.md#type) > ## 表达式模式(Expression Pattern) {#expression-pattern} diff --git a/source/03_language_reference/09_Generic_Parameters_and_Arguments.md b/source/03_language_reference/09_Generic_Parameters_and_Arguments.md index 604cb7b4..84fe5b5a 100755 --- a/source/03_language_reference/09_Generic_Parameters_and_Arguments.md +++ b/source/03_language_reference/09_Generic_Parameters_and_Arguments.md @@ -79,9 +79,9 @@ extension Collection where Element: SomeProtocol { #### generic-parameter {#generic-parameter} > *泛形形参* → [类型名称](./03_Types.md#type-name) > -> *泛形形参* → [类型名称](./03_Types.md#type-name) **:** [类型标识符](./03-Types.md#type-identifier) +> *泛形形参* → [类型名称](./03_Types.md#type-name) **:** [类型标识符](./03_Types.md#type-identifier) > -> *泛形形参* → [类型名称](./03_Types.md#type-name) **:** [协议合成类型](./03-Types.md#protocol-composition-type) +> *泛形形参* → [类型名称](./03_Types.md#type-name) **:** [协议合成类型](./03_Types.md#protocol-composition-type) > > #### requirement-clause {#requirement-clause} @@ -99,13 +99,13 @@ extension Collection where Element: SomeProtocol { > #### conformance-requirement {#conformance-requirement} > -> *一致性约束* → [类型标识符](./03_Types.md#type-identifier) **:** [类型标识符](./03-Types.md#type-identifier) +> *一致性约束* → [类型标识符](./03_Types.md#type-identifier) **:** [类型标识符](./03_Types.md#type-identifier) > -> *一致性约束* → [类型标识符](./03_Types.md#type-identifier) **:** [协议合成类型](./03-Types.md#protocol-composition-type) +> *一致性约束* → [类型标识符](./03_Types.md#type-identifier) **:** [协议合成类型](./03_Types.md#protocol-composition-type) > #### same-type-requirement {#same-type-requirement} -> *同类型约束* → [类型标识符](./03_Types.md#type-identifier) **==** [类型](./03-Types.md#type) +> *同类型约束* → [类型标识符](./03_Types.md#type-identifier) **==** [类型](./03_Types.md#type) > ## 泛型实参子句 {#generic-argument} diff --git a/source/03_language_reference/10_Summary_of_the_Grammar.md b/source/03_language_reference/10_Summary_of_the_Grammar.md index 0e5f1cbb..511521d2 100755 --- a/source/03_language_reference/10_Summary_of_the_Grammar.md +++ b/source/03_language_reference/10_Summary_of_the_Grammar.md @@ -4,7 +4,7 @@ > 空白字符语法 > -> *空白字符* → [空白字符项](./02_Lexical_Structure.md#whitespace-item) [空白字符](./02-Lexical-Structure.md#whitespace)可选 +> *空白字符* → [空白字符项](./02_Lexical_Structure.md#whitespace-item) [空白字符](./02_Lexical_Structure.md#whitespace)可选 > > *空白字符项* → [换行符](./02_Lexical_Structure.md#line-break) > @@ -24,19 +24,19 @@ > > > -> *注释* → **//** [单行内容注释](./02_Lexical_Structure.md#comment-text) [换行符](./02-Lexical-Structure.md#line-break) +> *注释* → **//** [单行内容注释](./02_Lexical_Structure.md#comment-text) [换行符](./02_Lexical_Structure.md#line-break) > > *注释* → **/\*** [多行内容注释](./02_Lexical_Structure.md#multiline-comment-text) **\*/** > > > -> *注释内容* → [注释内容项](./02_Lexical_Structure.md#comment-text-item) [注释内容](./02-Lexical-Structure.md#comment-text)可选 +> *注释内容* → [注释内容项](./02_Lexical_Structure.md#comment-text-item) [注释内容](./02_Lexical_Structure.md#comment-text)可选 > > *注释内容项* → 除 U+000A 或 U+000D 外的任何 Unicode 标量值 > > > -> *多行注释内容* → [多行注释内容项](./02_Lexical_Structure.md#multiline-comment-text-item) [多行注释内容](./02-Lexical-Structure.md#multiline-comment-text)可选 +> *多行注释内容* → [多行注释内容项](./02_Lexical_Structure.md#multiline-comment-text-item) [多行注释内容](./02_Lexical_Structure.md#multiline-comment-text)可选 > > *多行注释内容项* → [多行内容](./02_Lexical_Structure.md#multiline-comment) > @@ -49,15 +49,15 @@ > 标识符语法 > -> *标识符* → [标识符头(Head)](./02_Lexical_Structure.md#identifier-head) [标识符字符集](./02-Lexical-Structure.md#identifier-characters)可选 +> *标识符* → [标识符头(Head)](./02_Lexical_Structure.md#identifier-head) [标识符字符集](./02_Lexical_Structure.md#identifier-characters)可选 > -> *标识符* → [标识符头(Head)](./02_Lexical_Structure.md#identifier-head) [标识符字符集](./02-Lexical-Structure.md#identifier-characters)可选 +> *标识符* → [标识符头(Head)](./02_Lexical_Structure.md#identifier-head) [标识符字符集](./02_Lexical_Structure.md#identifier-characters)可选 > > *标识符* → [隐式参数名](./02_Lexical_Structure.md#implicit-parameter-name) > > *标识符* → [属性包装器呈现值](./02_Lexical_Structure.md#property-wrapper-projection) > -> *标识符集* → [标识符](./02_Lexical_Structure.md#identifier) | [标识符](./02-Lexical-Structure.md#identifier) **,** [标识符集](./02-Lexical-Structure.md#identifier-list) +> *标识符集* → [标识符](./02_Lexical_Structure.md#identifier) | [标识符](./02_Lexical_Structure.md#identifier) **,** [标识符集](./02_Lexical_Structure.md#identifier-list) > > *标识符头(Head)* → 大写或者小写字母 A 到 Z > @@ -97,20 +97,20 @@ > > *标识符字符* → [标识符头(Head)](./02_Lexical_Structure.md#identifier-head) > -> *标识符字符集* → [标识符字符](./02_Lexical_Structure.md#identifier-character) [标识符字符集](./02-Lexical-Structure.md#identifier-characters)可选 +> *标识符字符集* → [标识符字符](./02_Lexical_Structure.md#identifier-character) [标识符字符集](./02_Lexical_Structure.md#identifier-characters)可选 > > *隐式参数名* → **$** [十进制数字集](./02_Lexical_Structure.md#decimal-digits) > -> *属性包装器呈现值* → **$** [标识符字符集](./02-Lexical-Structure.md#identifier-characters) +> *属性包装器呈现值* → **$** [标识符字符集](./02_Lexical_Structure.md#identifier-characters) > > 字面量语法 > -> *字面量* → [数值型字面量](./02_Lexical_Structure.md#numeric-literal) | [字符串字面量](./02-Lexical-Structure.md#string-literal) | [布尔字面量](./02-Lexical-Structure.md#boolean-literal) | [空字面量](./02-Lexical-Structure.md#nil-literal) +> *字面量* → [数值型字面量](./02_Lexical_Structure.md#numeric-literal) | [字符串字面量](./02_Lexical_Structure.md#string-literal) | [布尔字面量](./02_Lexical_Structure.md#boolean-literal) | [空字面量](./02_Lexical_Structure.md#nil-literal) > -> *数值型字面量* → **-**可选[整形字面量](./02_Lexical_Structure.md#integer-literal) | **-**可选[浮点型字面量](./02-Lexical-Structure.md#floating-point-literal) +> *数值型字面量* → **-**可选[整形字面量](./02_Lexical_Structure.md#integer-literal) | **-**可选[浮点型字面量](./02_Lexical_Structure.md#floating-point-literal) > > *布尔字面量* → **true** | **false** > @@ -129,56 +129,56 @@ > > *整型字面量* → [十六进制字面量](./02_Lexical_Structure.md#hexadecimal-literal) > -> *二进制字面量* → **0b** [二进制数字](./02_Lexical_Structure.md#binary-digit) [二进制字面量字符集](./02-Lexical-Structure.md#binary-literal-characters)可选 +> *二进制字面量* → **0b** [二进制数字](./02_Lexical_Structure.md#binary-digit) [二进制字面量字符集](./02_Lexical_Structure.md#binary-literal-characters)可选 > > *二进制数字* → 数值 0 到 1 > > *二进制字面量字符* → [二进制数字](./02_Lexical_Structure.md#binary-digit) | **-** > -> *二进制字面量字符集* → [二进制字面量字符](./02_Lexical_Structure.md#binary-literal-character) [二进制字面量字符集](./02-Lexical-Structure.md#binary-literal-characters)可选 +> *二进制字面量字符集* → [二进制字面量字符](./02_Lexical_Structure.md#binary-literal-character) [二进制字面量字符集](./02_Lexical_Structure.md#binary-literal-characters)可选 > -> *八进制字面量* → **0o** [八进制数字](./02_Lexical_Structure.md#octal-digit) [八进制字符集](./02-Lexical-Structure.md#octal-literal-characters)可选 +> *八进制字面量* → **0o** [八进制数字](./02_Lexical_Structure.md#octal-digit) [八进制字符集](./02_Lexical_Structure.md#octal-literal-characters)可选 > > *八进字数字* → 数值 0 到 7 > > *八进制字符* → [八进制数字](./02_Lexical_Structure.md#octal-digit) | **-** > -> *八进制字符集* → [八进制字符](./02_Lexical_Structure.md#octal-literal-character) [八进制字符集](./02-Lexical-Structure.md#octal-literal-characters)可选 +> *八进制字符集* → [八进制字符](./02_Lexical_Structure.md#octal-literal-character) [八进制字符集](./02_Lexical_Structure.md#octal-literal-characters)可选 > -> *十进制字面量* → [十进制数字](./02_Lexical_Structure.md#decimal-digit) [十进制字符集](./02-Lexical-Structure.md#decimal-literal-characters)可选 +> *十进制字面量* → [十进制数字](./02_Lexical_Structure.md#decimal-digit) [十进制字符集](./02_Lexical_Structure.md#decimal-literal-characters)可选 > > *十进制数字* → 数值 0 到 9 > -> *十进制数字集* → [十进制数字](./02_Lexical_Structure.md#decimal-digit) [十进制数字集](./02-Lexical-Structure.md#decimal-digits)可选 +> *十进制数字集* → [十进制数字](./02_Lexical_Structure.md#decimal-digit) [十进制数字集](./02_Lexical_Structure.md#decimal-digits)可选 > > *十进制字面量字符* → [十进制数字](./02_Lexical_Structure.md#decimal-digit) | **-** > -> *十进制字面量字符集* → [十进制字面量字符](./02_Lexical_Structure.md#decimal-literal-character) [十进制字面量字符集](./02-Lexical-Structure.md#decimal-literal-characters)可选 +> *十进制字面量字符集* → [十进制字面量字符](./02_Lexical_Structure.md#decimal-literal-character) [十进制字面量字符集](./02_Lexical_Structure.md#decimal-literal-characters)可选 > -> *十六进制字面量* → **0x** [十六进制数字](./02_Lexical_Structure.md#hexadecimal-digit) [十六进制字面量字符集](./02-Lexical-Structure.md#hexadecimal-literal-characters)可选 +> *十六进制字面量* → **0x** [十六进制数字](./02_Lexical_Structure.md#hexadecimal-digit) [十六进制字面量字符集](./02_Lexical_Structure.md#hexadecimal-literal-characters)可选 > > *十六进制数字* → 数值 0 到 9,a 到 f,或者 A 到 F > > *十六进制字符* → [十六进制数字](./02_Lexical_Structure.md#hexadecimal-digit) | **-** > -> *十六进制字面量字符集* → [十六进制字符](./02_Lexical_Structure.md#hexadecimal-literal-character) [十六进制字面量字符集](./02-Lexical-Structure.md#hexadecimal-literal-characters)可选 +> *十六进制字面量字符集* → [十六进制字符](./02_Lexical_Structure.md#hexadecimal-literal-character) [十六进制字面量字符集](./02_Lexical_Structure.md#hexadecimal-literal-characters)可选 > > 浮点型字面量语法 > -> *浮点数字面量* → [十进制字面量](./02_Lexical_Structure.md#decimal-literal) [十进制分数](./02-Lexical-Structure.md#decimal-fraction)可选[十进制指数](./02-Lexical-Structure.md#decimal-exponent)可选 +> *浮点数字面量* → [十进制字面量](./02_Lexical_Structure.md#decimal-literal) [十进制分数](./02_Lexical_Structure.md#decimal-fraction)可选[十进制指数](./02_Lexical_Structure.md#decimal-exponent)可选 > -> *浮点数字面量* → [十六进制字面量](./02_Lexical_Structure.md#hexadecimal-literal) [十六进制分数](./02-Lexical-Structure.md#hexadecimal-fraction)可选[十六进制指数](./02-Lexical-Structure.md#hexadecimal-exponent) +> *浮点数字面量* → [十六进制字面量](./02_Lexical_Structure.md#hexadecimal-literal) [十六进制分数](./02_Lexical_Structure.md#hexadecimal-fraction)可选[十六进制指数](./02_Lexical_Structure.md#hexadecimal-exponent) > > *十进制分数* → **.** [十进制字面量](./02_Lexical_Structure.md#decimal-literal) > -> *十进制指数* → [浮点数 e](./02_Lexical_Structure.md#floating-point-e) [正负号](./02-Lexical-Structure.md#sign)可选[十进制字面量](./02-Lexical-Structure.md#decimal-literal) +> *十进制指数* → [浮点数 e](./02_Lexical_Structure.md#floating-point-e) [正负号](./02_Lexical_Structure.md#sign)可选[十进制字面量](./02_Lexical_Structure.md#decimal-literal) > > *十六进制分数* → **.** [十六进制数](./02_Lexical_Structure.md#hexadecimal-literal) > -> *十六进制指数* → [浮点数 p](./02_Lexical_Structure.md#floating-point-p) [正负号](./02-Lexical-Structure.md#sign)可选[十六进制字面量](./02-Lexical-Structure.md#hexadecimal-literal) +> *十六进制指数* → [浮点数 p](./02_Lexical_Structure.md#floating-point-p) [正负号](./02_Lexical_Structure.md#sign)可选[十六进制字面量](./02_Lexical_Structure.md#hexadecimal-literal) > > *浮点数 e* → **e** | **E** > @@ -191,21 +191,21 @@ > 字符串型字面量语法 -> *字符串字面量* → [静态字符串字面量](./02_Lexical_Structure.md#static-string-literal) | [插值字符串字面量](./02-Lexical-Structure.md#interpolated-string-literal) +> *字符串字面量* → [静态字符串字面量](./02_Lexical_Structure.md#static-string-literal) | [插值字符串字面量](./02_Lexical_Structure.md#interpolated-string-literal) > > *字符串开分隔定界符* → [字符串扩展分隔符](./02_Lexical_Structure.md#extended-string-literal-delimiter) **"** > > *字符串闭分隔定界符* → **"** [字符串扩展分隔符](./02_Lexical_Structure.md#extended-string-literal-delimiter)可选 > -> *静态字符串字面量* → [字符串开分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) [引用文本](./02-Lexical-Structure.md#quoted-text)可选 [字符串闭分隔定界符](./02-Lexical-Structure.md#extended-string-literal-delimiter) +> *静态字符串字面量* → [字符串开分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) [引用文本](./02_Lexical_Structure.md#quoted-text)可选 [字符串闭分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) > -> *静态字符串字面量* → [多行字符串开分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) [多行引用文本](./02-Lexical-Structure.md#multiline-quoted-text)可选 [多行字符串闭分隔定界符](./02-Lexical-Structure.md#extended-string-literal-delimiter) +> *静态字符串字面量* → [多行字符串开分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) [多行引用文本](./02_Lexical_Structure.md#multiline-quoted-text)可选 [多行字符串闭分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) > > *多行字符串开分隔定界符* → [字符串扩展分隔符](./02_Lexical_Structure.md#extended-string-literal-delimiter) **"""** > > *多行字符串闭分隔定界符* → **"""** [字符串扩展分隔符](./02_Lexical_Structure.md#extended-string-literal-delimiter) > -> *字符串扩展分隔符* → **#** [字符串扩展分隔符](./02-Lexical-Structure.md#extended-string-literal-delimiter)可选 +> *字符串扩展分隔符* → **#** [字符串扩展分隔符](./02_Lexical_Structure.md#extended-string-literal-delimiter)可选 > > *引用文本* → [引用文本项](./02_Lexical_Structure.md#quoted-text-item) [引用文本](#quoted-text)可选 > @@ -213,7 +213,7 @@ > > *引用文本项* → 除了 **"**、**\\\**、U+000A、U+000D 以外的所有 Unicode 字符 > -> *多行引用文本* → [多行引用文本项](./02_Lexical_Structure.md#multiline-quoted-text-item) [多行引用文本](./02-Lexical-Structure.md#multiline-quoted-text)可选 +> *多行引用文本* → [多行引用文本项](./02_Lexical_Structure.md#multiline-quoted-text-item) [多行引用文本](./02_Lexical_Structure.md#multiline-quoted-text)可选 > > *多行引用文本项* [转义字符](./02_Lexical_Structure.md#escaped-character)可选 > @@ -221,36 +221,36 @@ > > *多行引用文本* → [转义换行](./02_Lexical_Structure.md#escaped-newline) -> *插值字符串字面量* → [字符串开分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) [插值文本](./02-Lexical-Structure.md#interpolated-text)可选 [字符串闭分隔定界符](./02-Lexical-Structure.md#extended-string-literal-delimiter) +> *插值字符串字面量* → [字符串开分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) [插值文本](./02_Lexical_Structure.md#interpolated-text)可选 [字符串闭分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) > -> *插值字符串字面量* → [多行字符串开分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) [插值文本](./02-Lexical-Structure.md#interpolated-text)可选 [多行字符串闭分隔定界符](./02-Lexical-Structure.md#extended-string-literal-delimiter) +> *插值字符串字面量* → [多行字符串开分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) [插值文本](./02_Lexical_Structure.md#interpolated-text)可选 [多行字符串闭分隔定界符](./02_Lexical_Structure.md#extended-string-literal-delimiter) > -> *插值文本* → [插值文本项](./02_Lexical_Structure.md#interpolated-text-item) [插值文本](./02-Lexical-Structure.md#interpolated-text)可选 +> *插值文本* → [插值文本项](./02_Lexical_Structure.md#interpolated-text-item) [插值文本](./02_Lexical_Structure.md#interpolated-text)可选 > > *插值文本项* → **\\**(**[表达式](./04_Expressions.md)**) | [引用文本项](./02_Lexical_Structure.md#quoted-text-item) > -> *多行插值文本* → [多行插值文本项](./02_Lexical_Structure.md#multiline-quoted-text-item) [多行插值文本](./02-Lexical-Structure.md#multiline-quoted-text)可选 +> *多行插值文本* → [多行插值文本项](./02_Lexical_Structure.md#multiline-quoted-text-item) [多行插值文本](./02_Lexical_Structure.md#multiline-quoted-text)可选 > > *多行插值文本项* → **\\(** [表达式](./04_Expressions.md) **)** | [多行引用文本项](./02_Lexical_Structure.md#multiline-quoted-text-item) > > *转义序列* → **\\** [字符串扩展分隔符](./02_Lexical_Structure.md#extended-string-literal-delimiter) > -> *转义字符* → [转义序列](./02_Lexical_Structure.md#escape-sequence) **0** | [转义序列](./02-Lexical-Structure.md#escape-sequence) **\\** | [转义序列](./02-Lexical-Structure.md#escape-sequence) **t** | [转义序列](#escape-sequence) **n** | [转义序列](./02-Lexical-Structure.md#escape-sequence) **r** | [转义序列](./02-Lexical-Structure.md#escape-sequence) **\"** | [转义序列](./02-Lexical-Structure.md#escape-sequence) **'** +> *转义字符* → [转义序列](./02_Lexical_Structure.md#escape-sequence) **0** | [转义序列](./02_Lexical_Structure.md#escape-sequence) **\\** | [转义序列](./02_Lexical_Structure.md#escape-sequence) **t** | [转义序列](#escape-sequence) **n** | [转义序列](./02_Lexical_Structure.md#escape-sequence) **r** | [转义序列](./02_Lexical_Structure.md#escape-sequence) **\"** | [转义序列](./02_Lexical_Structure.md#escape-sequence) **'** > -> *转义字符* → [转义序列](./02_Lexical_Structure.md#escape-sequence) **u {** [unicode 标量数字](./02-Lexical-Structure.md#unicode-scalar-digits) **}** +> *转义字符* → [转义序列](./02_Lexical_Structure.md#escape-sequence) **u {** [unicode 标量数字](./02_Lexical_Structure.md#unicode-scalar-digits) **}** > > *unicode 标量数字* → 一到八位的十六进制数字 > -> *转义换行符* → [转义序列](./02_Lexical_Structure.md#escape-sequence) [空白](./02-Lexical-Structure.md#whitespace)可选 [换行符](./02-Lexical-Structure.md#line-break) +> *转义换行符* → [转义序列](./02_Lexical_Structure.md#escape-sequence) [空白](./02_Lexical_Structure.md#whitespace)可选 [换行符](./02_Lexical_Structure.md#line-break) > 运算符语法语法 > -> *运算符* → [运算符头](./02_Lexical_Structure.md#operator-character) [运算符字符集](./02-Lexical-Structure.md#operator)可选 +> *运算符* → [运算符头](./02_Lexical_Structure.md#operator-character) [运算符字符集](./02_Lexical_Structure.md#operator)可选 > -> *运算符* → [点运算符头](./02_Lexical_Structure.md#dot-operator-head) [点运算符字符集](./02-Lexical-Structure.md#dot-operator-characters)可选 +> *运算符* → [点运算符头](./02_Lexical_Structure.md#dot-operator-head) [点运算符字符集](./02_Lexical_Structure.md#dot-operator-characters)可选 > > *运算符字符* → **/** | **=** | **-** | **+** | **!** | ***** | **%** | **<** | **>** | **&** | **|** | **^** | **~** | **?** > @@ -296,13 +296,13 @@ > > *运算符字符* → U+E0100–U+E01EF > -> *运算符字符集* → [运算符字符](./02_Lexical_Structure.md#operator-character) [运算符字符集](./02-Lexical-Structure.md#operator-characters)可选 +> *运算符字符集* → [运算符字符](./02_Lexical_Structure.md#operator-character) [运算符字符集](./02_Lexical_Structure.md#operator-characters)可选 > > *点运算符头* → **..** > > *点运算符字符* → **.** | [运算符字符](./02_Lexical_Structure.md#operator-character) > -> *点运算符字符集* → [点运算符字符](./02_Lexical_Structure.md#dot-operator-character) [点运算符字符集](./02-Lexical-Structure.md#dot-operator-characters)可选 +> *点运算符字符集* → [点运算符字符](./02_Lexical_Structure.md#dot-operator-character) [点运算符字符集](./02_Lexical_Structure.md#dot-operator-characters)可选 > > *二元运算符* → [运算符](./02_Lexical_Structure.md#operator) > @@ -341,13 +341,13 @@ > 类型注解语法 > -> *类型注解* → **:** [属性(Attributes)集](./07_Attributes.md#attributes)可选[类型](./03-Types.md#type) +> *类型注解* → **:** [属性(Attributes)集](./07_Attributes.md#attributes)可选[类型](./03_Types.md#type) > 类型标识语法 > -> *类型标识* → [类型名称](./03_Types.md#type-name) [泛型参数从句](./09-Generic-Parameters-and-Arguments.md#generic-argument-clause)可选| [类型名称](./03-Types.md#type-name) [泛型参数从句](./09-Generic-Parameters-and-Arguments.md#generic-argument-clause)可选**.** [类型标识符](./03-Types.md#type-identifier) +> *类型标识* → [类型名称](./03_Types.md#type-name) [泛型参数从句](./09_Generic_Parameters_and_Arguments.md#generic-argument-clause)可选| [类型名称](./03_Types.md#type-name) [泛型参数从句](./09_Generic_Parameters_and_Arguments.md#generic-argument-clause)可选**.** [类型标识符](./03_Types.md#type-identifier) > > *类型名* → [标识符](./02_Lexical_Structure.md#identifier) > @@ -356,11 +356,11 @@ > 元组类型语法 > -> *元组类型* → **(** **)** | **(** [元组类型元素](./03_Types.md#tuple-type-element) **,** [元组类型元素列表](./03-Types.md#tuple-type-element-list) **)** +> *元组类型* → **(** **)** | **(** [元组类型元素](./03_Types.md#tuple-type-element) **,** [元组类型元素列表](./03_Types.md#tuple-type-element-list) **)** > -> *元组类型元素列表* → [元组类型元素](./03_Types.md#tuple-type-element) | [元组类型元素](./03-Types.md#tuple-type-element) **,** [元组类型元素列表](./03-Types.md#tuple-type-element-list) +> *元组类型元素列表* → [元组类型元素](./03_Types.md#tuple-type-element) | [元组类型元素](./03_Types.md#tuple-type-element) **,** [元组类型元素列表](./03_Types.md#tuple-type-element-list) > -> *元组类型元素* → [元素名](./03_Types.md#element-name) [类型注解](./03-Types.md#type-annotation) | [类型](./03-Types.md#type) +> *元组类型元素* → [元素名](./03_Types.md#element-name) [类型注解](./03_Types.md#type-annotation) | [类型](./03_Types.md#type) > > *元素名* → [标识符](./02_Lexical_Structure.md#identifier) @@ -368,15 +368,15 @@ > 函数类型语法 > -> *函数类型* → [类型](./03_Types.md#type) **throws**可选**->** [类型](./03-Types.md#type) +> *函数类型* → [类型](./03_Types.md#type) **throws**可选**->** [类型](./03_Types.md#type) > -> *函数类型* → [类型](./03_Types.md#) **rethrows** **->** [类型](./03-Types.md#) +> *函数类型* → [类型](./03_Types.md#) **rethrows** **->** [类型](./03_Types.md#) > > *函数类型子句* → **(** **)** > > *函数类型子句* → **(** [函数类型参数列表](./03_Types.md#function-type-argument-list) *...*­可选 **)** > -> *函数类型参数列表* → [函数类型参数](./03_Types.md#function-type-argument) | [函数类型参数](function-type-argument), [函数类型参数列表](./03-Types.md#function-type-argument-list) +> *函数类型参数列表* → [函数类型参数](./03_Types.md#function-type-argument) | [函数类型参数](function-type-argument), [函数类型参数列表](./03_Types.md#function-type-argument-list) > > *函数类型参数* → [特性列表](./07_Attributes.md#attributes)可选 **输入输出参数**可选 [类型](#type) | [参数标签](#argument-label) [类型注解](#type-annotation) > @@ -411,15 +411,15 @@ > 协议合成类型语法 > -> *协议合成类型* → [类型标识符](./03_Types.md#type-identifier) | [协议合成延续](./03-Types.md#protocol-composition-continuation) +> *协议合成类型* → [类型标识符](./03_Types.md#type-identifier) | [协议合成延续](./03_Types.md#protocol-composition-continuation) > -> *协议持续延续* → [类型标识符](./03_Types.md#type-identifier) | [协议合成类型](./03-Types.md#protocol-composition-type) +> *协议持续延续* → [类型标识符](./03_Types.md#type-identifier) | [协议合成类型](./03_Types.md#protocol-composition-type) > 元(Metatype)类型语法 > -> *元类型* → [类型](./03_Types.md#type) **.** **Type** | [类型](./03-Types.md#type) **.** **Protocol** +> *元类型* → [类型](./03_Types.md#type) **.** **Type** | [类型](./03_Types.md#type) **.** **Protocol** @@ -427,7 +427,7 @@ > > *类型继承从句* → **:** [类型继承集](./03_Types.md#type-inheritance-list) > -> *类型继承集* → [类型标识符](./03_Types.md#type-identifier) | [类型标识符](./03-Types.md#type-identifier) **,** [类型继承集](./03-Types.md#type-inheritance-list) +> *类型继承集* → [类型标识符](./03_Types.md#type-identifier) | [类型标识符](./03_Types.md#type-identifier) **,** [类型继承集](./03_Types.md#type-inheritance-list) > > *类条件* → **class** @@ -435,9 +435,9 @@ > 表达式语法 > -> *表达式* → [try 运算符](./04_Expressions.md#try-operator)可选 [前缀表达式](./04-Expressions.md#prefix-expression) [二元表达式列表](./04-Expressions.md#binary-expressions) +> *表达式* → [try 运算符](./04_Expressions.md#try-operator)可选 [前缀表达式](./04_Expressions.md#prefix-expression) [二元表达式列表](./04_Expressions.md#binary-expressions) > -> *表达式列表* → [表达式](./04_Expressions.md#expression)|[表达式](./04-Expressions.md#expression), [表达式列表](./04-Expressions.md#expression-list) +> *表达式列表* → [表达式](./04_Expressions.md#expression)|[表达式](./04_Expressions.md#expression), [表达式列表](./04_Expressions.md#expression-list) > @@ -462,15 +462,15 @@ > 二元表达式语法 > -> *二元表达式* → [二元运算符](./02_Lexical_Structure.md#binary-operator) [前缀表达式](./04-Expressions.md#prefix-expression) +> *二元表达式* → [二元运算符](./02_Lexical_Structure.md#binary-operator) [前缀表达式](./04_Expressions.md#prefix-expression) > -> *二元表达式* → [赋值操作符](./06_Declarations.md#class-declaration) [try 运算符](./04-Expressions.md#try-operator)可选 [前缀表达式](./04-Expressions.md#prefix-expression) +> *二元表达式* → [赋值操作符](./06_Declarations.md#class-declaration) [try 运算符](./04_Expressions.md#try-operator)可选 [前缀表达式](./04_Expressions.md#prefix-expression) > -> *二元表达式* → [条件运算符](./04_Expressions.md#conditional-operator) [try 运算符](./04-Expressions.md#try-operator)可选 [前缀表达式](./04-Expressions.md#prefix-expression) +> *二元表达式* → [条件运算符](./04_Expressions.md#conditional-operator) [try 运算符](./04_Expressions.md#try-operator)可选 [前缀表达式](./04_Expressions.md#prefix-expression) > > *二元表达式* → [类型转换运算符](./04_Expressions.md#type-casting-operator) > -> *二元表达式* → [二元表达式](./04_Expressions.md#binary-expression) [二元表达式列表](./04-Expressions.md#binary-expressions)可选 +> *二元表达式* → [二元表达式](./04_Expressions.md#binary-expression) [二元表达式列表](./04_Expressions.md#binary-expressions)可选 > @@ -502,7 +502,7 @@ > 基础表达式语法 > -> *基础表达式* → [标识符](./02_Lexical_Structure.md#identifier) [泛型实参子句](./09-Generic-Parameters-and-Arguments.md#generic-argument-clause)可选 +> *基础表达式* → [标识符](./02_Lexical_Structure.md#identifier) [泛型实参子句](./09_Generic_Parameters_and_Arguments.md#generic-argument-clause)可选 > > *基础表达式* → [字面量表达式](./04_Expressions.md#literal-expression) > @@ -532,24 +532,24 @@ > > *字面量表达式* → [字面量](./04_Expressions.md#literal-expression) > -> *字面量表达式* → [数组字面量](./04_Expressions.md#array-literal) | [字典字面量](./04-Expressions.md#dictionary-literal) | [练习场字面量](./04-Expressions.md#playground-literal) +> *字面量表达式* → [数组字面量](./04_Expressions.md#array-literal) | [字典字面量](./04_Expressions.md#dictionary-literal) | [练习场字面量](./04_Expressions.md#playground-literal) > > *字面量表达式* → **#file** | **#filePath** | **#line** | **#column** | **#function** | **dsohandle** > >*数组字面量* → **[** [数组字面量项列表](./04_Expressions.md#array-literal-items)可选 **]** -> *数组字面量项列表* → [数组字面量项](./04_Expressions.md#array-literal-item)可选 | [数组字面量项](./04-Expressions.md#array-literal-item),[数组字面量项列表](./04-Expressions.md#array-literal-items) +> *数组字面量项列表* → [数组字面量项](./04_Expressions.md#array-literal-item)可选 | [数组字面量项](./04_Expressions.md#array-literal-item),[数组字面量项列表](./04_Expressions.md#array-literal-items) > *数组字面量项* → [表达式](./04_Expressions.md#expression) > > >*字典字面量* → [[字典字面量项列表](./04_Expressions.md#dictionary-literal-items) **]** | **[** **:** **]** > > -> *字典字面量项列表* → [字典字面量项](./04_Expressions.md#dictionary-literal-item) ,**可选 | [字典字面量项](./04-Expressions.md#dictionary-literal-item) ,[字典字面量项列表](./04-Expressions.md#dictionary-literal-items) +> *字典字面量项列表* → [字典字面量项](./04_Expressions.md#dictionary-literal-item) ,**可选 | [字典字面量项](./04_Expressions.md#dictionary-literal-item) ,[字典字面量项列表](./04_Expressions.md#dictionary-literal-items) > ->*字典字面量项* → [表达式](./04_Expressions.md#expression) **:** [表达式](./04-Expressions.md#expression) +>*字典字面量项* → [表达式](./04_Expressions.md#expression) **:** [表达式](./04_Expressions.md#expression) > > -> *palyground 字面量* → **#colorLiteral ( red : [表达式](./04-Expressions.md#expression) , green :[表达式](./04-Expressions.md#expression), blue :[表达式](./04-Expressions.md#expression) , alpha : [表达式](./04-Expressions.md#expression) )** +> *palyground 字面量* → **#colorLiteral ( red : [表达式](./04_Expressions.md#expression) , green :[表达式](./04_Expressions.md#expression), blue :[表达式](./04_Expressions.md#expression) , alpha : [表达式](./04_Expressions.md#expression) )** > >*playground 字面量* → **#fileLiteral ( resourceName : [表达式](#expression) )** > @@ -558,7 +558,7 @@ > self 表达式语法 > -> *self 表达式* → **self** | [self 方法表达式](./04_Expressions.md#self-method-expression) | [self 下标表达式](./04-Expressions.md#self-subscript-expression) | [self 构造器表达式](./04-Expressions.md#self-initializer-expression) +> *self 表达式* → **self** | [self 方法表达式](./04_Expressions.md#self-method-expression) | [self 下标表达式](./04_Expressions.md#self-subscript-expression) | [self 构造器表达式](./04_Expressions.md#self-initializer-expression) > > > *self 方法表达式* → **self** **.** [标识符](./02_Lexical_Structure.md#identifier) @@ -571,7 +571,7 @@ > 父类表达式语法 > -> *父类表达式* → [父类方法表达式](./04_Expressions.md#superclass-method-expression) | [父类下标表达式](./04-Expressions.md#superclass-subscript-expression) | [父类构造器表达式](./04-Expressions.md#superclass-initializer-expression) +> *父类表达式* → [父类方法表达式](./04_Expressions.md#superclass-method-expression) | [父类下标表达式](./04_Expressions.md#superclass-subscript-expression) | [父类构造器表达式](./04_Expressions.md#superclass-initializer-expression) > > *父类方法表达式* → **super** **.** [标识符](./02_Lexical_Structure.md#identifier) > @@ -585,30 +585,30 @@ > 闭包表达式语法 > -> *闭包表达式* → **{** [闭包签名](./04_Expressions.md#closure-signature)可选 [语句](./04-Expressions.md#statements) **}** +> *闭包表达式* → **{** [闭包签名](./04_Expressions.md#closure-signature)可选 [语句](./04_Expressions.md#statements) **}** > > -> 闭包签名* → [参数子句](./04_Expressions.md#parameter-clause) [函数结果](05-Declarations.md#function-result)可选 **in** +> 闭包签名* → [参数子句](./04_Expressions.md#parameter-clause) [函数结果](./06_Declarations.md#function-result)可选 **in** > -> *闭包签名* → [标识符列表](./04_Expressions.md#identifier-list) [函数结果](05-Declarations.md#function-result)可选 **in** +> *闭包签名* → [标识符列表](./04_Expressions.md#identifier-list) [函数结果](./06_Declarations.md#function-result)可选 **in** > > -> *闭包参数子句* **(** **)** | **(** [闭包参数列表](./04_Expressions.md#closure-parameter-list) | [标识符列表](./04-Expressions.md#identifier-list) **)** +> *闭包参数子句* **(** **)** | **(** [闭包参数列表](./04_Expressions.md#closure-parameter-list) | [标识符列表](./04_Expressions.md#identifier-list) **)** > -> *闭包参数列表* [闭包参数](./04_Expressions.md#implicit-member-expression) | [闭包参数](./04-Expressions.md#implicit-member-expression), [闭包参数列表](./04-Expressions.md#implicit-member-expression) +> *闭包参数列表* [闭包参数](./04_Expressions.md#implicit-member-expression) | [闭包参数](./04_Expressions.md#implicit-member-expression), [闭包参数列表](./04_Expressions.md#implicit-member-expression) > -> *闭包参数* [闭包参数名](./04_Expressions.md#implicit-member-expression) [类型声明](./03-Types.md#type-annotation) 可选 +> *闭包参数* [闭包参数名](./04_Expressions.md#implicit-member-expression) [类型声明](./03_Types.md#type-annotation) 可选 > -> *闭包参数* [闭包参数名](./04_Expressions.md#implicit-member-expression) [类型声明](./03-Types.md#type-annotation) **...** +> *闭包参数* [闭包参数名](./04_Expressions.md#implicit-member-expression) [类型声明](./03_Types.md#type-annotation) **...** > > *闭包参数名* [标识符](./02_Lexical_Structure.md#identifier) > > -> *捕获列表* → [捕获列表](./04_Expressions.md#capture-list) **[** [捕获列表项列表](./04-Expressions.md#capture-list-items) **]** +> *捕获列表* → [捕获列表](./04_Expressions.md#capture-list) **[** [捕获列表项列表](./04_Expressions.md#capture-list-items) **]** > -> *捕获列表项列表* → [捕获列表项](./04_Expressions.md#capture-list-item) | [捕获列表项](./04-Expressions.md#capture-list-item) **,** [捕获列表项列表](./04-Expressions.md#capture-list-items) +> *捕获列表项列表* → [捕获列表项](./04_Expressions.md#capture-list-item) | [捕获列表项](./04_Expressions.md#capture-list-item) **,** [捕获列表项列表](./04_Expressions.md#capture-list-items) > -> *捕获列表项* → [捕获说明符](./04_Expressions.md#capture-specifier)可选 [*表达式*](./04-Expressions.md#expression) +> *捕获列表项* → [捕获说明符](./04_Expressions.md#capture-specifier)可选 [*表达式*](./04_Expressions.md#expression) > > *捕获说明符* → **weak** | **unowned** | **unowned(safe)** | **unowned(unsafe)** > @@ -632,10 +632,10 @@ > 元组表达式语法 > -> *元组表达式* → **( )** | **(**[元组元素](./04_Expressions.md#tuple-element), [元组元素列表](./04-Expressions.md#tuple-element-list) **)** +> *元组表达式* → **( )** | **(**[元组元素](./04_Expressions.md#tuple-element), [元组元素列表](./04_Expressions.md#tuple-element-list) **)** > -> *元组元素列表* → [元组元素](./04_Expressions.md#tuple-element) | [元组元素](./04-Expressions.md#tuple-element) **,** [元组元素列表](./04-Expressions.md#tuple-element-list) -> *元组元素* → [表达式](./04_Expressions.md#expression) | [标识符](./04-Expressions.md#identifier) **:** [表达式](./04-Expressions.md##expression) +> *元组元素列表* → [元组元素](./04_Expressions.md#tuple-element) | [元组元素](./04_Expressions.md#tuple-element) **,** [元组元素列表](./04_Expressions.md#tuple-element-list) +> *元组元素* → [表达式](./04_Expressions.md#expression) | [标识符](./04_Expressions.md#identifier) **:** [表达式](./04_Expressions.md##expression) > @@ -651,9 +651,9 @@ > key-path表达式语法 > > *key-path 表达式* → **\** [类型](./03_Types.md#type)可选 **.** [多个 key-path 组件] -> *多个 key-path 组件* → [key-path 组件](./04_Expressions.md#key-path-component) | [key-path 组件](./04-Expressions.md#key-path-component) **.** [多个 key-path 组件](./04-Expressions.md#key-path-components) -> *key-path 组件* → [标识符](./02_Lexical_Structure.md#identifier) [多个 key-path 后缀](./04-Expressions.md#key-path-postfixes)可选 | [多个 key-path 后缀](./04-Expressions.md#key-path-postfixes) -> *多个 key-path 后缀* → [key-path 后缀](./04_Expressions.md#key-path-postfix) [多个 key-path 后缀](./04-Expressions.md#key-path-postfixes)可选 key-path-postfixes {./04-Expressions.md#key-path-postfixes} +> *多个 key-path 组件* → [key-path 组件](./04_Expressions.md#key-path-component) | [key-path 组件](./04_Expressions.md#key-path-component) **.** [多个 key-path 组件](./04_Expressions.md#key-path-components) +> *key-path 组件* → [标识符](./02_Lexical_Structure.md#identifier) [多个 key-path 后缀](./04_Expressions.md#key-path-postfixes)可选 | [多个 key-path 后缀](./04_Expressions.md#key-path-postfixes) +> *多个 key-path 后缀* → [key-path 后缀](./04_Expressions.md#key-path-postfix) [多个 key-path 后缀](./04_Expressions.md#key-path-postfixes)可选 key-path-postfixes {./04_Expressions.md#key-path-postfixes} > > *key-path 后缀* → **?** | **!** | **self** | **\[** [函数调用参数表](./04_Expressions.md#function-call-argument-list) **\]** > @@ -663,17 +663,17 @@ > 选择器表达式语法 > -> *选择器表达式* → **#selector** **(** [*表达式*](./04-Expressions.md#expression) **)** +> *选择器表达式* → **#selector** **(** [*表达式*](./04_Expressions.md#expression) **)** > -> *选择器表达式* → **#selector** **(** [*getter:表达式*](./04-Expressions.md#expression) **)** +> *选择器表达式* → **#selector** **(** [*getter:表达式*](./04_Expressions.md#expression) **)** > -> *选择器表达式* → **#selector** **(** [*setter:表达式*](./04-Expressions.md#expression) **)** +> *选择器表达式* → **#selector** **(** [*setter:表达式*](./04_Expressions.md#expression) **)** > > key-path 字符串表达式语法 -> *key-path 字符串表达式* → **#keyPath (** [表达式](./04-Expressions.md#expression) **)** +> *key-path 字符串表达式* → **#keyPath (** [表达式](./04_Expressions.md#expression) **)** > @@ -682,7 +682,7 @@ > > *后缀表达式* → [基本表达式](./04_Expressions.md#primary-expression) > -> *后缀表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) [后缀运算符](02-Lexical-Structure.md#postfix-operator) +> *后缀表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) [后缀运算符](02_Lexical_Structure.md#postfix-operator) > > *后缀表达式* → [函数调用表达式](./04_Expressions.md#function-call-expression) > @@ -703,23 +703,23 @@ > 函数调用表达式语法 > -> *函数调用表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) [函数调用参数子句](./04-Expressions.md#function-call-argument-clause) +> *函数调用表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) [函数调用参数子句](./04_Expressions.md#function-call-argument-clause) > -> *函数调用表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) [函数调用参数子句](./04-Expressions.md#function-call-argument-clause)可选 [尾随闭包](./04-Expressions.md#trailing-closure) +> *函数调用表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) [函数调用参数子句](./04_Expressions.md#function-call-argument-clause)可选 [尾随闭包](./04_Expressions.md#trailing-closure) > > *函数调用参数子句* → **(** **)** | **(** [函数调用参数表](./04_Expressions.md#function-call-argument-list) **)** > -> *函数调用参数表* → [函数调用参数](./04_Expressions.md#function-call-argument) | [函数调用参数](./04-Expressions.md#function-call-argument) **,** [函数调用参数表](./04-Expressions.md#function-call-argument-list) +> *函数调用参数表* → [函数调用参数](./04_Expressions.md#function-call-argument) | [函数调用参数](./04_Expressions.md#function-call-argument) **,** [函数调用参数表](./04_Expressions.md#function-call-argument-list) > -> *函数调用参数* → [表达式](./04_Expressions.md#expression) | [标识符](02-Lexical-Structure.md#identifier) **:** [表达式](./04-Expressions.md#expression) +> *函数调用参数* → [表达式](./04_Expressions.md#expression) | [标识符](02_Lexical_Structure.md#identifier) **:** [表达式](./04_Expressions.md#expression) > -> *函数调用参数* → [运算符](./02_Lexical_Structure.md#operator) | [标识符](./02-Lexical-Structure.md#identifier) **:** [运算符](./02-Lexical-Structure.md#operator) +> *函数调用参数* → [运算符](./02_Lexical_Structure.md#operator) | [标识符](./02_Lexical_Structure.md#identifier) **:** [运算符](./02_Lexical_Structure.md#operator) > > *尾随闭包* → [闭包表达式](./04_Expressions.md#closure-expression) [标签尾随闭包]()可选 > > *标签尾随闭包集*→ [标签尾随闭包](./04_Expressions.md#labeled-trailing-closure) [标签尾随闭包集](./04_Expressions.md#labeled-trailing-closures) > -> *标签尾随闭包*→ [标识符](./02-Lexical-Structure.md#identifier) **:** [闭包表达式](./04_Expressions.md#closure-expression) +> *标签尾随闭包*→ [标识符](./02_Lexical_Structure.md#identifier) **:** [闭包表达式](./04_Expressions.md#closure-expression) @@ -727,20 +727,20 @@ > > *构造器表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **.** **init** > -> *构造器表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **.** **init** **(** [参数名称](./04-Expressions.md#argument-names) **)** +> *构造器表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **.** **init** **(** [参数名称](./04_Expressions.md#argument-names) **)** > > 显式成员表达式语法 > -> *显式成员表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **.** [十进制数字] (02-Lexical-Structure.md#decimal-digit) +> *显式成员表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **.** [十进制数字] (02_Lexical_Structure.md#decimal-digit) > -> *显式成员表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **.** [标识符](02-Lexical-Structure.md#identifier) [泛型实参子句](./09-Generic-Parameters-and-Arguments.md#generic-argument-clause)可选
+> *显式成员表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **.** [标识符](02_Lexical_Structure.md#identifier) [泛型实参子句](./09_Generic_Parameters_and_Arguments.md#generic-argument-clause)可选
> -> *显式成员表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **.** [标识符] (02-Lexical-Structure.md#identifier) **(** [参数名称](./04-Expressions.md#argument-names) **)** +> *显式成员表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **.** [标识符] (02_Lexical_Structure.md#identifier) **(** [参数名称](./04_Expressions.md#argument-names) **)** > -> *参数名称* → [参数名](./04_Expressions.md#argument-name) [参数名称](./04-Expressions.md#argument-names)可选
+> *参数名称* → [参数名](./04_Expressions.md#argument-name) [参数名称](./04_Expressions.md#argument-names)可选
> > *参数名* → [标识符](./02_Lexical_Structure.md#identifier) **:** > @@ -756,7 +756,7 @@ > 下标表达式语法 > -> *下标表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **[** [表达式列表](./04-Expressions.md#expression-list) **]** +> *下标表达式* → [后缀表达式](./04_Expressions.md#postfix-expression) **[** [表达式列表](./04_Expressions.md#expression-list) **]** > @@ -794,7 +794,7 @@ > > *语句* → [编译控制语句](./05_Statements.md#compiler-control-statement) > -> *语句集* → [语句](./05_Statements.md#statement) [语句集](./05-Statements.md#statements)可选 +> *语句集* → [语句](./05_Statements.md#statement) [语句集](./05_Statements.md#statements)可选 > @@ -812,27 +812,27 @@ > For-In 循环语法 > -> *for-in 语句* → **for case**可选 [模式](./08_Patterns.md#pattern) **in** [表达式](./04-Expressions.md#expression) [where 子句](./05-Statements.md#where-clause)可选 [代码块](./06-Declarations.md#code-block) +> *for-in 语句* → **for case**可选 [模式](./08_Patterns.md#pattern) **in** [表达式](./04_Expressions.md#expression) [where 子句](./05_Statements.md#where-clause)可选 [代码块](./06_Declarations.md#code-block) > > While 循环语法 > -> *while 语句* → **while** [条件集](./05_Statements.md#condition-list) [代码块](./06-Declarations.md#code-block) +> *while 语句* → **while** [条件集](./05_Statements.md#condition-list) [代码块](./06_Declarations.md#code-block) > -> *条件集* → [条件](./05_Statements.md#condition) | [条件](./05-Statements.md#condition) **,** [条件集](./05-Statements.md#condition-list) -> *条件* → [表达式](./04_Expressions.md#expression) | [可用性条件](./05-Statements.md#availability-condition) | [case 条件](./05-Statements.md#case-condition) | [可选绑定条件](./05-Statements.md#optional-binding-condition) +> *条件集* → [条件](./05_Statements.md#condition) | [条件](./05_Statements.md#condition) **,** [条件集](./05_Statements.md#condition-list) +> *条件* → [表达式](./04_Expressions.md#expression) | [可用性条件](./05_Statements.md#availability-condition) | [case 条件](./05_Statements.md#case-condition) | [可选绑定条件](./05_Statements.md#optional-binding-condition) > -> *case 条件* → **case** [模式](./08_Patterns.md#pattern) [构造器](./06-Declarations.md#initializer) +> *case 条件* → **case** [模式](./08_Patterns.md#pattern) [构造器](./06_Declarations.md#initializer) > -> *可选绑定条件* → **let** [模式](./08_Patterns.md#pattern) [构造器](./06-Declarations.md#initializer) | **var** [模式](./08-Patterns.md#pattern) [构造器](./06-Declarations.md#initializer) +> *可选绑定条件* → **let** [模式](./08_Patterns.md#pattern) [构造器](./06_Declarations.md#initializer) | **var** [模式](./08_Patterns.md#pattern) [构造器](./06_Declarations.md#initializer) > > Repeat-While 语句语法 > -*repeat-while-statement* → **repeat** [代码块](./06_Declarations.md#code-block) **while** [表达式](./04-Expressions.md#expression) +*repeat-while-statement* → **repeat** [代码块](./06_Declarations.md#code-block) **while** [表达式](./04_Expressions.md#expression) @@ -849,15 +849,15 @@ > If 语句语法 > -> *if 语句* → **if** [条件集](./05_Statements.md#condition-list) [代码块](./06-Declarations.md#code-block) [else 子句](./05-Statements.md#else-clause)可选 +> *if 语句* → **if** [条件集](./05_Statements.md#condition-list) [代码块](./06_Declarations.md#code-block) [else 子句](./05_Statements.md#else-clause)可选 > -> *else 子句* → **else** [代码块](./06_Declarations.md#code-block) | **else** [if 语句](./05-Statements.md#if-statement) +> *else 子句* → **else** [代码块](./06_Declarations.md#code-block) | **else** [if 语句](./05_Statements.md#if-statement) > > Guard 语句语法 > -> *guard 语句* → **guard** [条件集](./05_Statements.md#condition-list) **else** [代码块](./06-Declarations.md#code-block) +> *guard 语句* → **guard** [条件集](./05_Statements.md#condition-list) **else** [代码块](./06_Declarations.md#code-block) > @@ -865,19 +865,19 @@ > Switch 语句语法 > -> *switch 语句* → **switch** [表达式](./04_Expressions.md#expression) **{** [switch-case集](./05-Statements.md#switch-cases)可选 **}** +> *switch 语句* → **switch** [表达式](./04_Expressions.md#expression) **{** [switch-case集](./05_Statements.md#switch-cases)可选 **}** > -> *switch-case集* → [switch-case](./05_Statements.md#switch-case) [switch-case集](./05-Statements.md#switch-cases)可选 +> *switch-case集* → [switch-case](./05_Statements.md#switch-case) [switch-case集](./05_Statements.md#switch-cases)可选 > -> *switch-case* → [case 标签](./05_Statements.md#case-label) [语句集](./05-Statements.md#statements) +> *switch-case* → [case 标签](./05_Statements.md#case-label) [语句集](./05_Statements.md#statements) > -> *switch-case* → [default 标签](./05_Statements.md#default-label) [语句集](./05-Statements.md#statements) +> *switch-case* → [default 标签](./05_Statements.md#default-label) [语句集](./05_Statements.md#statements) > > *switch-case* → [条件 switch-case](./05_Statements.md#conditional-switch-case) > -> *case 标签* → [特性](./07_Attributes.md#attributes)可选 **case** [case 项集](./05-Statements.md#case-item-list) **:** +> *case 标签* → [特性](./07_Attributes.md#attributes)可选 **case** [case 项集](./05_Statements.md#case-item-list) **:** > -> *case 项集* → [模式](./08_Patterns.md#pattern) [where 子句](./05-Statements.md#where-clause)可选 | [模式](./08-Patterns.md#pattern) [where 子句](./05-Statements.md#guard-clause)可选 **,** [case 项集](./05-Statements.md#case-item-list) +> *case 项集* → [模式](./08_Patterns.md#pattern) [where 子句](./05_Statements.md#where-clause)可选 | [模式](./08_Patterns.md#pattern) [where 子句](./05_Statements.md#guard-clause)可选 **,** [case 项集](./05_Statements.md#case-item-list) > > *default 标签* → [特性](./07_Attributes.md#attributes)可选 **default** **:** > @@ -885,28 +885,28 @@ > > *where 表达式* → [表达式](./04_Expressions.md#expression) > -> *条件 switch-case* → [switch if 指令子句](./05_Statements.md#switch-if-directive-clause) [switch elseif 指令子句集](./05-Statements.md#switch-elseif-directive-clauses)可选 [switch else 指令子句](./05-Statements.md#switch-else-directive-clause)可选 [endif 指令](./05-Statements.md#endif-directive) +> *条件 switch-case* → [switch if 指令子句](./05_Statements.md#switch-if-directive-clause) [switch elseif 指令子句集](./05_Statements.md#switch-elseif-directive-clauses)可选 [switch else 指令子句](./05_Statements.md#switch-else-directive-clause)可选 [endif 指令](./05_Statements.md#endif-directive) > -> *switch if 指令子句* → [if 指令](./05_Statements.md#if-directive) [编译条件](./05-Statements.md#compilation-condition) [switch-case集](./05-Statements.md#switch-cases)可选 +> *switch if 指令子句* → [if 指令](./05_Statements.md#if-directive) [编译条件](./05_Statements.md#compilation-condition) [switch-case集](./05_Statements.md#switch-cases)可选 > -> *switch elseif 指令子句集* → [elseif 指令子句](./05_Statements.md#else-if-directive-clause) [switch elseif 指令子句集](./05-Statements.md#switch-elseif-directive-clauses)可选 +> *switch elseif 指令子句集* → [elseif 指令子句](./05_Statements.md#else-if-directive-clause) [switch elseif 指令子句集](./05_Statements.md#switch-elseif-directive-clauses)可选 > -> *switch elseif 指令子句* → [elseif 指令](./05_Statements.md#elseif-directive) [编译条件](./05-Statements.md#compilation-condition) [switch-case集](./05-Statements.md#switch-cases)可选 +> *switch elseif 指令子句* → [elseif 指令](./05_Statements.md#elseif-directive) [编译条件](./05_Statements.md#compilation-condition) [switch-case集](./05_Statements.md#switch-cases)可选 > -> *switch else 指令子句* → [else 指令](./05_Statements.md#else-directive) [switch-case集](./05-Statements.md#switch-cases)可选 +> *switch else 指令子句* → [else 指令](./05_Statements.md#else-directive) [switch-case集](./05_Statements.md#switch-cases)可选 > > 标签语句语法 > -> *标签语句* → [语句标签](./05_Statements.md#statement-label) [循环语句](./05-Statements.md#loop-statement) +> *标签语句* → [语句标签](./05_Statements.md#statement-label) [循环语句](./05_Statements.md#loop-statement) > -> *标签语句* → [语句标签](./05_Statements.md#statement-label) [if 语句](./05-Statements.md#if-statement) +> *标签语句* → [语句标签](./05_Statements.md#statement-label) [if 语句](./05_Statements.md#if-statement) > -> *标签语句* → [语句标签](./05_Statements.md#statement-label) [switch 语句](./05-Statements.md#switch-statement) +> *标签语句* → [语句标签](./05_Statements.md#statement-label) [switch 语句](./05_Statements.md#switch-statement) > -> *标签语句* → [语句标签](./05_Statements.md#statement-label) [do 语句](./05-Statements.md#do-statement) +> *标签语句* → [语句标签](./05_Statements.md#statement-label) [do 语句](./05_Statements.md#do-statement) > > *语句标签* → [标签名称](./05_Statements.md#label-name) **:** > @@ -974,15 +974,15 @@ > Do 语句语法 > -> *do 语句* → **do** [代码块](./06_Declarations.md#code-block) [catch 子句集](./05-Statements.md#catch-clauses)可选 +> *do 语句* → **do** [代码块](./06_Declarations.md#code-block) [catch 子句集](./05_Statements.md#catch-clauses)可选 > -> *catch 子句集* → [catch 子句](./05_Statements.md#catch-clause) [catch 子句集](05-Statements.md#catch-clauses)可选 +> *catch 子句集* → [catch 子句](./05_Statements.md#catch-clause) [catch 子句集](05_Statements.md#catch-clauses)可选 > -> *catch 子句* → **catch** [catch 模式列表]()可选 [代码块](./06-Declarations.md#code-block)可选 +> *catch 子句* → **catch** [catch 模式列表]()可选 [代码块](./06_Declarations.md#code-block)可选 > > *catch 模式列表* → [catch 模式](./05_Statements.md#catch-pattern) | [catch 模式](./05_Statements.md#catch-pattern) ,[catch 模式列表](./05_Statements.md#catch-pattern-list) > -> *catch 模式* → [模式](./08_Patterns.md#pattern) [where 子句](./05-Statements.md#where-clause)可选 +> *catch 模式* → [模式](./08_Patterns.md#pattern) [where 子句](./05_Statements.md#where-clause)可选 > 编译控制语句 @@ -997,15 +997,15 @@ > 条件编译块语法 > -> *条件编译块* → [if 指令子句](./05_Statements.md#if-directive-clause) [elseif 指令子句集](./05-Statements.md#elseif-directive-clauses)可选 [else 指令子句](./05-Statements.md#else-directive-clause)可选 [endif 指令](./05-Statements.md#endif-directive) +> *条件编译块* → [if 指令子句](./05_Statements.md#if-directive-clause) [elseif 指令子句集](./05_Statements.md#elseif-directive-clauses)可选 [else 指令子句](./05_Statements.md#else-directive-clause)可选 [endif 指令](./05_Statements.md#endif-directive) > -> *if 指令子句* → [if 指令](./05_Statements.md#if-directive) [编译条件](./05-Statements.md#compilation-condition) [语句集](./05-Statements.md#statements)可选 +> *if 指令子句* → [if 指令](./05_Statements.md#if-directive) [编译条件](./05_Statements.md#compilation-condition) [语句集](./05_Statements.md#statements)可选 > -> *elseif 指令子句集* → [elseif 指令子句](./05_Statements.md#else-if-directive-clause) [elseif 指令子句集](./05-Statements.md#elseif-directive-clauses)可选 +> *elseif 指令子句集* → [elseif 指令子句](./05_Statements.md#else-if-directive-clause) [elseif 指令子句集](./05_Statements.md#elseif-directive-clauses)可选 > -> *elseif 指令子句* → [elseif 指令](./05_Statements.md#elseif-directive) [编译条件](./05-Statements.md#compilation-condition) [语句集](./05-Statements.md#statements)可选 +> *elseif 指令子句* → [elseif 指令](./05_Statements.md#elseif-directive) [编译条件](./05_Statements.md#compilation-condition) [语句集](./05_Statements.md#statements)可选 > -> *else 指令子句* → [else 指令](./05_Statements.md#else-directive) [语句集](./05-Statements.md#statements)可选 +> *else 指令子句* → [else 指令](./05_Statements.md#else-directive) [语句集](./05_Statements.md#statements)可选 > > *if 指令* → **#if** > @@ -1025,17 +1025,17 @@ > > *编译条件* → **!** [编译条件](./05_Statements.md#compilation-condition) > -> *编译条件* → [编译条件](./05_Statements.md#compilation-condition) **&&** [编译条件](./05-Statements.md#compilation-condition) +> *编译条件* → [编译条件](./05_Statements.md#compilation-condition) **&&** [编译条件](./05_Statements.md#compilation-condition) > -> *编译条件* → [编译条件](./05_Statements.md#compilation-condition) **||** [编译条件](./05-Statements.md#compilation-condition) +> *编译条件* → [编译条件](./05_Statements.md#compilation-condition) **||** [编译条件](./05_Statements.md#compilation-condition) > > *平台条件* → **os** **(** [操作系统](./05_Statements.md#operating-system) **)** > > *平台条件* → **arch** **(** [架构](./05_Statements.md#architecture) **)** > -> *平台条件* → **swift** **(** **>=** [swift 版本](./05_Statements.md#swift-version) **)** | **swift** **(** **<** [swift 版本](./05-Statements.md#swift-version) **)** +> *平台条件* → **swift** **(** **>=** [swift 版本](./05_Statements.md#swift-version) **)** | **swift** **(** **<** [swift 版本](./05_Statements.md#swift-version) **)** > -> *平台条件* → **compiler** **(** **>=** [swift 版本](./05_Statements.md#swift-version) **)** | **compiler** **(** **<** [swift 版本](./05-Statements.md#swift-version) **)** +> *平台条件* → **compiler** **(** **>=** [swift 版本](./05_Statements.md#swift-version) **)** | **compiler** **(** **<** [swift 版本](./05_Statements.md#swift-version) **)** > > *平台条件* → **canImport** **(** [模块名](./05_Statements.md#module-name) **)** > @@ -1045,9 +1045,9 @@ > > *架构* → **i386** | **x86_64** | **arm** | **arm64** > -> *swift 版本* → [十进制数字集](./02_Lexical_Structure.md#decimal-digits) [swift 版本后缀](./05-Statements.md#swift-version-continuation)可选 +> *swift 版本* → [十进制数字集](./02_Lexical_Structure.md#decimal-digits) [swift 版本后缀](./05_Statements.md#swift-version-continuation)可选 > -> *swift 版本后缀* → **.** [十进制数字集](./02_Lexical_Structure.md#decimal-digits) [swift 版本集](./05-Statements.md#swift-version-continuation)可选 +> *swift 版本后缀* → **.** [十进制数字集](./02_Lexical_Structure.md#decimal-digits) [swift 版本集](./05_Statements.md#swift-version-continuation)可选 > > *模块名* → [标识符](./02_Lexical_Structure.md#identifier) > @@ -1056,7 +1056,7 @@ > 行控制语句语法 > -> *行控制语句* → **#sourceLocation** **(** **file:** [文件名](./05-Statements.md#file-name) **,** **line:** [行号](./05-Statements.md#line-number) **)** +> *行控制语句* → **#sourceLocation** **(** **file:** [文件名](./05_Statements.md#file-name) **,** **line:** [行号](./05_Statements.md#line-number) **)** > > *行控制语句* → **#sourceLocation** **(** **)** > @@ -1068,9 +1068,9 @@ > 编译期诊断语句语法 > -> *诊断语句* → **#error** **(** [诊断信息](./05-Statements.md#diagnostic-message) **)** +> *诊断语句* → **#error** **(** [诊断信息](./05_Statements.md#diagnostic-message) **)** > -> *诊断语句* → **#warning** **(** [诊断信息](./05-Statements.md#diagnostic-message) **)** +> *诊断语句* → **#warning** **(** [诊断信息](./05_Statements.md#diagnostic-message) **)** > > *诊断信息* → [静态字符串字面量](./02_Lexical_Structure.md#static-string-literal) > @@ -1078,11 +1078,11 @@ > 可用性条件语法 > -> *可用性条件* → **#available** **(** [可用性参数集](./05-Statements.md#availability-arguments) **)** +> *可用性条件* → **#available** **(** [可用性参数集](./05_Statements.md#availability-arguments) **)** > -> *可用性参数集* → [可用性参数](./05_Statements.md#availability-argument) | [可用性参数](./05-Statements.md#availability-argument) , [可用性参数集)](./05-Statements.md#availability-arguments) +> *可用性参数集* → [可用性参数](./05_Statements.md#availability-argument) | [可用性参数](./05_Statements.md#availability-argument) , [可用性参数集)](./05_Statements.md#availability-arguments) > -> *可用性参数* → [平台名](./05_Statements.md#platform-name) [平台版本](./05-Statements.md#platform-version) +> *可用性参数* → [平台名](./05_Statements.md#platform-name) [平台版本](./05_Statements.md#platform-version) > > *可用性参数* → **\*** > @@ -1096,9 +1096,9 @@ > > *平台版本* → [十进制数字集](./02_Lexical_Structure.md#decimal-digits) > -> *平台版本* → [十进制数字集](./02_Lexical_Structure.md#decimal-digits) **.** [十进制数字集](./02-Lexical-Structure.md#decimal-digits) +> *平台版本* → [十进制数字集](./02_Lexical_Structure.md#decimal-digits) **.** [十进制数字集](./02_Lexical_Structure.md#decimal-digits) > -> *平台版本* → [十进制数字集](./02_Lexical_Structure.md#decimal-digits) **.** [十进制数字集](./02-Lexical-Structure.md#decimal-digits) **.** [十进制数字集](./02-Lexical-Structure.md#decimal-digits) +> *平台版本* → [十进制数字集](./02_Lexical_Structure.md#decimal-digits) **.** [十进制数字集](./02_Lexical_Structure.md#decimal-digits) **.** [十进制数字集](./02_Lexical_Structure.md#decimal-digits) > ## 声明 {#declarations} @@ -1135,7 +1135,7 @@ > > *声明* → [优先级组声明](./06_Declarations.md#precedence-group-declaration) > -> *声明集* → [声明](./06_Declarations.md#declaration) [声明集](./06-Declarations.md#declarations)可选 +> *声明集* → [声明](./06_Declarations.md#declaration) [声明集](./06_Declarations.md#declarations)可选 > @@ -1157,24 +1157,24 @@ > 导入声明语法 > -> *导入声明* → [特性](./07_Attributes.md#attributes)可选 **import** [导入类型](./06-Declarations.md#import-kind)可选 [导入路径](./06-Declarations.md#import-path) +> *导入声明* → [特性](./07_Attributes.md#attributes)可选 **import** [导入类型](./06_Declarations.md#import-kind)可选 [导入路径](./06_Declarations.md#import-path) > > *导入类型* → **typealias** | **struct** | **class** | **enum** | **protocol** | **let** | **var** | **func** > -> *导入路径* → [导入路径标识符](./06_Declarations.md#import-path-identifier) | [导入路径标识符](./06-Declarations.md#import-path-identifier) **.** [导入路径](./06-Declarations.md#import-path) +> *导入路径* → [导入路径标识符](./06_Declarations.md#import-path-identifier) | [导入路径标识符](./06_Declarations.md#import-path-identifier) **.** [导入路径](./06_Declarations.md#import-path) > -> *导入路径标识符* → [标识符](./02_Lexical_Structure.md#identifier) | [运算符](./02-Lexical-Structure.md#operator) +> *导入路径标识符* → [标识符](./02_Lexical_Structure.md#identifier) | [运算符](./02_Lexical_Structure.md#operator) > > 常数声明语法 > -> *常量声明* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06-Declarations.md#declaration-specifiers)可选 **let** [模式构造器集](./06-Declarations.md#pattern-initializer-list) +> *常量声明* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06_Declarations.md#declaration-specifiers)可选 **let** [模式构造器集](./06_Declarations.md#pattern-initializer-list) > -> *模式构造器集* → [模式构造器](./06_Declarations.md#pattern-initializer) | [模式构造器](./06-Declarations.md#pattern-initializer) **,** [模式构造器集](./06-Declarations.md#pattern-initializer-list) +> *模式构造器集* → [模式构造器](./06_Declarations.md#pattern-initializer) | [模式构造器](./06_Declarations.md#pattern-initializer) **,** [模式构造器集](./06_Declarations.md#pattern-initializer-list) > -> *模式构造器* → [模式](./08_Patterns.md#pattern) [构造器](./06-Declarations.md#initializer)可选 +> *模式构造器* → [模式](./08_Patterns.md#pattern) [构造器](./06_Declarations.md#initializer)可选 > > *构造器* → **=** [表达式](./04_Expressions.md#expression) @@ -1182,57 +1182,57 @@ > 变量声明语法 > -> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [模式构造器集](./06-Declarations.md#pattern-initializer-list) +> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [模式构造器集](./06_Declarations.md#pattern-initializer-list) > -> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06-Declarations.md#variable-name) [类型注解](./03-Types.md#type-annotation) [代码块](./06-Declarations.md#code-block) +> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06_Declarations.md#variable-name) [类型注解](./03_Types.md#type-annotation) [代码块](./06_Declarations.md#code-block) > -> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06-Declarations.md#variable-name) [类型注解](./03-Types.md#type-annotation) [getter-setter 块](./06-Declarations.md#getter-setter-block) +> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06_Declarations.md#variable-name) [类型注解](./03_Types.md#type-annotation) [getter-setter 块](./06_Declarations.md#getter-setter-block) > -> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06-Declarations.md#variable-name) [类型注解](./03-Types.md#type-annotation) [getter-setter 关键字块](./06-Declarations.md#getter-setter-keyword-block) +> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06_Declarations.md#variable-name) [类型注解](./03_Types.md#type-annotation) [getter-setter 关键字块](./06_Declarations.md#getter-setter-keyword-block) > -> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06-Declarations.md#variable-name) [构造器](./06-Declarations.md#initializer)可选 [willSet-didSet 代码块](./06-Declarations.md#willSet-didSet-block) +> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06_Declarations.md#variable-name) [构造器](./06_Declarations.md#initializer)可选 [willSet-didSet 代码块](./06_Declarations.md#willSet-didSet-block) > -> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06-Declarations.md#variable-name) [类型注解](./03-Types.md#type-annotation) [构造器](./06-Declarations.md#initializer)可选 [willSet-didSet 代码块](./06-Declarations.md#willSet-didSet-block) +> *变量声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06_Declarations.md#variable-name) [类型注解](./03_Types.md#type-annotation) [构造器](./06_Declarations.md#initializer)可选 [willSet-didSet 代码块](./06_Declarations.md#willSet-didSet-block) > -> *变量声明头* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06-Declarations.md#declaration-specifiers)可选 **var** +> *变量声明头* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06_Declarations.md#declaration-specifiers)可选 **var** > > *变量名称* → [标识符](./02_Lexical_Structure.md#identifier) > > *getter-setter 块* → [代码块](./06_Declarations.md#code-block) > -> *getter-setter 块* → **{** [getter 子句](./06_Declarations.md#getter-keyword-clause) [setter 子句](./06-Declarations.md#setter-keyword-clause)可选 **}** +> *getter-setter 块* → **{** [getter 子句](./06_Declarations.md#getter-keyword-clause) [setter 子句](./06_Declarations.md#setter-keyword-clause)可选 **}** > -> *getter-setter 块* → **{** [setter 子句](./06_Declarations.md#setter-keyword-clause) [getter 子句](./06-Declarations.md#getter-keyword-clause) **}** +> *getter-setter 块* → **{** [setter 子句](./06_Declarations.md#setter-keyword-clause) [getter 子句](./06_Declarations.md#getter-keyword-clause) **}** > -> *getter 子句* → [特性](./07_Attributes.md#attributes)可选 [可变性修饰符](./06-Declarations.md#mutation-modifier)可选 **get** [代码块](./06-Declarations.md#code-block) +> *getter 子句* → [特性](./07_Attributes.md#attributes)可选 [可变性修饰符](./06_Declarations.md#mutation-modifier)可选 **get** [代码块](./06_Declarations.md#code-block) > -> *setter 子句* → [特性](./07_Attributes.md#attributes)可选 [可变性修饰符](./06-Declarations.md#mutation-modifier)可选 **set** [setter 名称](./06-Declarations.md#setter-name)可选 [代码块](./06-Declarations.md#code-block) +> *setter 子句* → [特性](./07_Attributes.md#attributes)可选 [可变性修饰符](./06_Declarations.md#mutation-modifier)可选 **set** [setter 名称](./06_Declarations.md#setter-name)可选 [代码块](./06_Declarations.md#code-block) > > *setter 名称* → **(** [标识符](./02_Lexical_Structure.md#identifier) **)** > -> *getter-setter 关键字(Keyword)块* → **{** [getter 关键字子句](./06_Declarations.md#getter-keyword-clause) [setter 关键字子句](./06-Declarations.md#setter-keyword-clause)可选 **}** +> *getter-setter 关键字(Keyword)块* → **{** [getter 关键字子句](./06_Declarations.md#getter-keyword-clause) [setter 关键字子句](./06_Declarations.md#setter-keyword-clause)可选 **}** > -> *getter-setter 关键字(Keyword)块* → **{** [setter 关键字子句](./06_Declarations.md#setter-keyword-clause) [getter 关键字子句](./06-Declarations.md#getter-keyword-clause) **}** +> *getter-setter 关键字(Keyword)块* → **{** [setter 关键字子句](./06_Declarations.md#setter-keyword-clause) [getter 关键字子句](./06_Declarations.md#getter-keyword-clause) **}** > -> *getter 关键字(Keyword)子句* → [特性](./07_Attributes.md#attributes)可选 [可变性修饰符](./06-Declarations.md#mutation-modifier)可选 **get** +> *getter 关键字(Keyword)子句* → [特性](./07_Attributes.md#attributes)可选 [可变性修饰符](./06_Declarations.md#mutation-modifier)可选 **get** > -> *setter 关键字(Keyword)子句* → [特性](./07_Attributes.md#attributes)可选 [可变性修饰符](./06-Declarations.md#mutation-modifier)可选 **set** +> *setter 关键字(Keyword)子句* → [特性](./07_Attributes.md#attributes)可选 [可变性修饰符](./06_Declarations.md#mutation-modifier)可选 **set** > -> *willSet-didSet 代码块* → **{** [willSet 子句](./06_Declarations.md#willSet-clause) [didSet 子句](./06-Declarations.md#didSet-clause)可选 **}** +> *willSet-didSet 代码块* → **{** [willSet 子句](./06_Declarations.md#willSet-clause) [didSet 子句](./06_Declarations.md#didSet-clause)可选 **}** > -> *willSet-didSet 代码块* → **{** [didSet 子句](./06_Declarations.md#didSet-clause) [willSet 子句](./06-Declarations.md#willSet-clause)可选 **}** +> *willSet-didSet 代码块* → **{** [didSet 子句](./06_Declarations.md#didSet-clause) [willSet 子句](./06_Declarations.md#willSet-clause)可选 **}** > -> *willSet 子句* → [特性](./07_Attributes.md#attributes)可选 **willSet** [setter 名称](./06-Declarations.md#setter-name)可选 [代码块](./06-Declarations.md#code-block) +> *willSet 子句* → [特性](./07_Attributes.md#attributes)可选 **willSet** [setter 名称](./06_Declarations.md#setter-name)可选 [代码块](./06_Declarations.md#code-block) > > *didSet 子句* → [特性](./07_Attributes.md#attributes)可选 > - **didSet** [setter 名称](./06_Declarations.md#setter-name)可选 [代码块](./06-Declarations.md#code-block) + **didSet** [setter 名称](./06_Declarations.md#setter-name)可选 [代码块](./06_Declarations.md#code-block) > 类型别名声明语法 > -> *类型别名声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07-Attributes.md#access-level-modifier) **typealias** [类型别名名称](./06-Declarations.md#typealias-name) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型别名赋值](./06-Declarations.md#typealias-assignment) +> *类型别名声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07_Attributes.md#access-level-modifier) **typealias** [类型别名名称](./06_Declarations.md#typealias-name) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型别名赋值](./06_Declarations.md#typealias-assignment) > > *类型别名名称* → [标识符](./02_Lexical_Structure.md#identifier) > @@ -1243,30 +1243,30 @@ > 函数声明语法 > -> *函数声明* → [函数头](./06_Declarations.md#function-head) [函数名](./06-Declarations.md#function-name) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [函数签名](./06-Declarations.md#function-signature) [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [函数体](./06-Declarations.md#function-body)可选 +> *函数声明* → [函数头](./06_Declarations.md#function-head) [函数名](./06_Declarations.md#function-name) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [函数签名](./06_Declarations.md#function-signature) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [函数体](./06_Declarations.md#function-body)可选 > -> *函数头* → [特性](./07_Attributes.md#attributes)可选 [声明描述符集](./06-Declarations.md#declaration-specifiers)可选 **func** +> *函数头* → [特性](./07_Attributes.md#attributes)可选 [声明描述符集](./06_Declarations.md#declaration-specifiers)可选 **func** > -> *函数名* → [标识符](./02_Lexical_Structure.md#identifier) | [运算符](./02-Lexical-Structure.md#operator) +> *函数名* → [标识符](./02_Lexical_Structure.md#identifier) | [运算符](./02_Lexical_Structure.md#operator) > -> *函数签名* → [参数子句](./06_Declarations.md#parameter-clause) **throws**可选 [函数结果](./06-Declarations.md#function-result)可选 +> *函数签名* → [参数子句](./06_Declarations.md#parameter-clause) **throws**可选 [函数结果](./06_Declarations.md#function-result)可选 > -> *函数签名* → [参数子句](./06_Declarations.md#parameter-clause) **rethrows** [函数结果](./06-Declarations.md#function-result)可选 +> *函数签名* → [参数子句](./06_Declarations.md#parameter-clause) **rethrows** [函数结果](./06_Declarations.md#function-result)可选 > -> *函数结果* → **->** [特性](./07_Attributes.md#attributes)可选 [类型](./03-Types.md#type) +> *函数结果* → **->** [特性](./07_Attributes.md#attributes)可选 [类型](./03_Types.md#type) > > *函数体* → [代码块](./06_Declarations.md#code-block) > > *参数子句* → **(** **)** | **(** [参数集](./06_Declarations.md#parameter-list) **)** > -> *参数集* → [参数](./06_Declarations.md#parameter) | [参数](./06-Declarations.md#parameter) **,** [参数集](./06-Declarations.md#parameter-list) +> *参数集* → [参数](./06_Declarations.md#parameter) | [参数](./06_Declarations.md#parameter) **,** [参数集](./06_Declarations.md#parameter-list) > -> *参数* → [外部参数名](./06_Declarations.md#parameter-name)可选 [本地参数名](./06-Declarations.md#local-parameter-name) [类型注解](./03-Types.md#type-annotation) [默认参数子句](./06-Declarations.md#default-argument-clause)可选 +> *参数* → [外部参数名](./06_Declarations.md#parameter-name)可选 [本地参数名](./06_Declarations.md#local-parameter-name) [类型注解](./03_Types.md#type-annotation) [默认参数子句](./06_Declarations.md#default-argument-clause)可选 > -> *参数* → [外部参数名](./06_Declarations.md#parameter-name)可选 [本地参数名](./06-Declarations.md#local-parameter-name) [类型注解](./03-Types.md#type-annotation) +> *参数* → [外部参数名](./06_Declarations.md#parameter-name)可选 [本地参数名](./06_Declarations.md#local-parameter-name) [类型注解](./03_Types.md#type-annotation) > -> *参数* → [外部参数名](./06_Declarations.md#parameter-name)可选 [本地参数名](./06-Declarations.md#local-parameter-name) [类型注解](./03-Types.md#type-annotation) **...** +> *参数* → [外部参数名](./06_Declarations.md#parameter-name)可选 [本地参数名](./06_Declarations.md#local-parameter-name) [类型注解](./03_Types.md#type-annotation) **...** > > *外部参数名* → [标识符](./02_Lexical_Structure.md#identifier) > @@ -1279,88 +1279,88 @@ > 枚举声明语法 > -> *枚举声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07-Attributes.md#access-level-modifier)可选 [联合式枚举](./06-Declarations.md#union-style-enum) +> *枚举声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07_Attributes.md#access-level-modifier)可选 [联合式枚举](./06_Declarations.md#union-style-enum) > -> *枚举声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07-Attributes.md#access-level-modifier)可选 [原始值式枚举](./06-Declarations.md#raw-value-style-enum) +> *枚举声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07_Attributes.md#access-level-modifier)可选 [原始值式枚举](./06_Declarations.md#raw-value-style-enum) > -> *联合式枚举* → **indirect**可选 **enum** [枚举名](./06_Declarations.md#enum-name) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03-Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 **{** [联合式枚举成员](./06-Declarations.md#union-style-enum-members)可选 **}** +> *联合式枚举* → **indirect**可选 **enum** [枚举名](./06_Declarations.md#enum-name) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03_Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 **{** [联合式枚举成员](./06_Declarations.md#union-style-enum-members)可选 **}** > -> *联合式枚举成员集* → [联合式枚举成员](./06_Declarations.md#union-style-enum-member) [联合样式枚举成员集](./06-Declarations.md#union-style-enum-members)可选 +> *联合式枚举成员集* → [联合式枚举成员](./06_Declarations.md#union-style-enum-member) [联合样式枚举成员集](./06_Declarations.md#union-style-enum-members)可选 > -> *联合样式枚举成员* → [声明](./06_Declarations.md#declaration) | [联合式枚举 case 子句](./06-Declarations.md#union-style-enum-case-clause) | [编译控制语句](./05-Statements.md#compiler-control-statement) +> *联合样式枚举成员* → [声明](./06_Declarations.md#declaration) | [联合式枚举 case 子句](./06_Declarations.md#union-style-enum-case-clause) | [编译控制语句](./05_Statements.md#compiler-control-statement) > -> *联合式枚举 case 子句* → [特性](./07_Attributes.md#attributes)可选 **indirect**可选 **case** [联合式枚举 case 集](./06-Declarations.md#union-style-enum-case-list) +> *联合式枚举 case 子句* → [特性](./07_Attributes.md#attributes)可选 **indirect**可选 **case** [联合式枚举 case 集](./06_Declarations.md#union-style-enum-case-list) > -> *联合式枚举 case 集* → [联合式枚举 case](./06_Declarations.md#union-style-enum-case) | [联合式枚举 case](./06-Declarations.md#union-style-enum-case) **,** [联合式枚举 case 集](./06-Declarations.md#union-style-enum-case-list) +> *联合式枚举 case 集* → [联合式枚举 case](./06_Declarations.md#union-style-enum-case) | [联合式枚举 case](./06_Declarations.md#union-style-enum-case) **,** [联合式枚举 case 集](./06_Declarations.md#union-style-enum-case-list) > -> *联合式枚举 case* → [枚举的 case 名](./06_Declarations.md#enum-case-name) [元组类型](./03-Types.md#tuple-type)可选 +> *联合式枚举 case* → [枚举的 case 名](./06_Declarations.md#enum-case-name) [元组类型](./03_Types.md#tuple-type)可选 > > *枚举名* → [标识符](./02_Lexical_Structure.md#identifier) > > *枚举的 case 名* → [标识符](./02_Lexical_Structure.md#identifier) > -> *原始值式枚举* → **enum** [枚举名](./06_Declarations.md#enum-name) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03-Types.md#type-inheritance-clause) [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 **{** [原始值式枚举成员集](./06-Declarations.md#raw-value-style-enum-members) **}** +> *原始值式枚举* → **enum** [枚举名](./06_Declarations.md#enum-name) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03_Types.md#type-inheritance-clause) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 **{** [原始值式枚举成员集](./06_Declarations.md#raw-value-style-enum-members) **}** > -> *原始值式枚举成员集* → [原始值式枚举成员](./06_Declarations.md#raw-value-style-enum-member) [原始值式枚举成员集](./06-Declarations.md#raw-value-style-enum-members)可选 +> *原始值式枚举成员集* → [原始值式枚举成员](./06_Declarations.md#raw-value-style-enum-member) [原始值式枚举成员集](./06_Declarations.md#raw-value-style-enum-members)可选 > -> *原始值式枚举成员* → [声明](./06_Declarations.md#declaration) | [原始值式枚举 case 子句](./06-Declarations.md#raw-value-style-enum-case-clause) | [编译控制语句](./05-Statements.md#compiler-control-statement) +> *原始值式枚举成员* → [声明](./06_Declarations.md#declaration) | [原始值式枚举 case 子句](./06_Declarations.md#raw-value-style-enum-case-clause) | [编译控制语句](./05_Statements.md#compiler-control-statement) > -> *原始值式枚举 case 子句* → [特性](./07_Attributes.md#attributes)可选 **case** [原始值式枚举 case 集](./06-Declarations.md#raw-value-style-enum-case-list) +> *原始值式枚举 case 子句* → [特性](./07_Attributes.md#attributes)可选 **case** [原始值式枚举 case 集](./06_Declarations.md#raw-value-style-enum-case-list) > -> *原始值式枚举 case 集* → [原始值式枚举 case](./06_Declarations.md#raw-value-style-enum-case) | [原始值式枚举 case](./06-Declarations.md#raw-value-style-enum-case) **,** [原始值式枚举 case 集](./06-Declarations.md#raw-value-style-enum-case-list) +> *原始值式枚举 case 集* → [原始值式枚举 case](./06_Declarations.md#raw-value-style-enum-case) | [原始值式枚举 case](./06_Declarations.md#raw-value-style-enum-case) **,** [原始值式枚举 case 集](./06_Declarations.md#raw-value-style-enum-case-list) > -> *原始值式枚举 case* → [枚举的 case 名](./06_Declarations.md#enum-case-name) [原始值赋值](./06-Declarations.md#raw-value-assignment)可选 +> *原始值式枚举 case* → [枚举的 case 名](./06_Declarations.md#enum-case-name) [原始值赋值](./06_Declarations.md#raw-value-assignment)可选 > > *原始值赋值* → **=** [原始值字面量](./02_Lexical_Structure.md#literal) > -> *原始值字面量(raw-value-literal)* → [数值字面量](./02_Lexical_Structure.md#literal) | [静态字符串字面量](./02-Lexical-Structure.md#literal) | [布尔字面量](./02-Lexical-Structure.md#literal) +> *原始值字面量(raw-value-literal)* → [数值字面量](./02_Lexical_Structure.md#literal) | [静态字符串字面量](./02_Lexical_Structure.md#literal) | [布尔字面量](./02_Lexical_Structure.md#literal) > > 结构体声明语法 > -> *结构体声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07-Attributes.md#access-level-modifier)可选 **struct** [结构体名称](./06-Declarations.md#struct-name) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03-Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [结构体主体](./06-Declarations.md#struct-body) +> *结构体声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07_Attributes.md#access-level-modifier)可选 **struct** [结构体名称](./06_Declarations.md#struct-name) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03_Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [结构体主体](./06_Declarations.md#struct-body) > > *结构体名称* → [标识符](./02_Lexical_Structure.md#identifier) > > *结构体主体* → **{** [结构体成员集](./06_Declarations.md#declarations)可选 **}** > -> *结构体成员集* → [结构体成员](./06_Declarations.md#declarations) [结构体成员集](./06-Declarations.md#declarations)可选 +> *结构体成员集* → [结构体成员](./06_Declarations.md#declarations) [结构体成员集](./06_Declarations.md#declarations)可选 > -> *结构体成员* → [声明集](./06_Declarations.md#declarations) | [编译控制语句](./05-Statements.md#compiler-control-statement) +> *结构体成员* → [声明集](./06_Declarations.md#declarations) | [编译控制语句](./05_Statements.md#compiler-control-statement) > > 类声明语法 > -> *类声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07-Attributes.md#access-level-modifier)可选 **final**可选 **class** [类名](./06-Declarations.md#class-name) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03-Types.md#type-inheritance-clause) [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [类主体](./06-Declarations.md#class-body) +> *类声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07_Attributes.md#access-level-modifier)可选 **final**可选 **class** [类名](./06_Declarations.md#class-name) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03_Types.md#type-inheritance-clause) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [类主体](./06_Declarations.md#class-body) > -> *类声明* → [特性](./07_Attributes.md#attributes)可选 **final** [访问级别修饰符](./07-Attributes.md#access-level-modifier)可选 **class** [类名](./06-Declarations.md#class-name) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03-Types.md#type-inheritance-clause) [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [类主体](./06-Declarations.md#class-body) +> *类声明* → [特性](./07_Attributes.md#attributes)可选 **final** [访问级别修饰符](./07_Attributes.md#access-level-modifier)可选 **class** [类名](./06_Declarations.md#class-name) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [类型继承子句](./03_Types.md#type-inheritance-clause) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [类主体](./06_Declarations.md#class-body) > > *类名* → [标识符](./02_Lexical_Structure.md#identifier) > > *类主体* → **{** [类成员集](./06_Declarations.md#declarations)可选 **}** > -> *类成员集* → [类成员](./06_Declarations.md#declarations) [类成员集](./06-Declarations.md#declarations)可选 +> *类成员集* → [类成员](./06_Declarations.md#declarations) [类成员集](./06_Declarations.md#declarations)可选 > -> *类成员* → [声明集](./06_Declarations.md#declarations) | [编译控制语句](./05-Statements.md#compiler-control-statement) +> *类成员* → [声明集](./06_Declarations.md#declarations) | [编译控制语句](./05_Statements.md#compiler-control-statement) > > 协议声明语法 > -> *协议声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07-Attributes.md#access-level-modifier)可选 **protocol** [协议名](./06-Declarations.md#protocol-name) [类型继承子句](./03-Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [协议主体](./06-Declarations.md#protocol-body) +> *协议声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07_Attributes.md#access-level-modifier)可选 **protocol** [协议名](./06_Declarations.md#protocol-name) [类型继承子句](./03_Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [协议主体](./06_Declarations.md#protocol-body) > > *协议名* → [标识符](./02_Lexical_Structure.md#identifier) > > *协议主体* → **{** [协议成员集](./06_Declarations.md#protocol-member-declarations)可选 **}** > -> *协议成员集* → [协议成员](./06_Declarations.md#declarations) [协议成员集](./06-Declarations.md#declarations)可选 +> *协议成员集* → [协议成员](./06_Declarations.md#declarations) [协议成员集](./06_Declarations.md#declarations)可选 > -> *协议成员* → [协议成员声明](./06_Declarations.md#declarations) | [编译控制语句](./05-Statements.md#compiler-control-statement) +> *协议成员* → [协议成员声明](./06_Declarations.md#declarations) | [编译控制语句](./05_Statements.md#compiler-control-statement) > > *协议成员声明* → [协议属性声明](./06_Declarations.md#protocol-property-declaration) > @@ -1379,52 +1379,52 @@ > 协议属性声明语法 > -> *协议属性声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06-Declarations.md#variable-name) [类型注解](./03-Types.md#type-annotation) [getter-setter 关键字块](./06-Declarations.md#getter-setter-keyword-block) +> *协议属性声明* → [变量声明头](./06_Declarations.md#variable-declaration-head) [变量名](./06_Declarations.md#variable-name) [类型注解](./03_Types.md#type-annotation) [getter-setter 关键字块](./06_Declarations.md#getter-setter-keyword-block) > > 协议方法声明语法 > -> *协议方法声明* → [函数头](./06_Declarations.md#function-head) [函数名](./06-Declarations.md#function-name) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [函数签名](./06-Declarations.md#function-signature) [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 +> *协议方法声明* → [函数头](./06_Declarations.md#function-head) [函数名](./06_Declarations.md#function-name) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [函数签名](./06_Declarations.md#function-signature) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 > > 协议构造器声明语法 > -> *协议构造器声明* → [构造器头](./06_Declarations.md#initializer-head) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [参数子句](./06-Declarations.md#parameter-clause) **throws**可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 +> *协议构造器声明* → [构造器头](./06_Declarations.md#initializer-head) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [参数子句](./06_Declarations.md#parameter-clause) **throws**可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 > -> *协议构造器声明* → [构造器头](./06_Declarations.md#initializer-head) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [参数子句](./06-Declarations.md#parameter-clause) **rethrows** [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 +> *协议构造器声明* → [构造器头](./06_Declarations.md#initializer-head) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [参数子句](./06_Declarations.md#parameter-clause) **rethrows** [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 > > 协议下标声明语法 > -> *协议下标声明* → [下标头](./06_Declarations.md#subscript-head) [下标结果](./06-Declarations.md#subscript-result) [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [getter-setter 关键字块](./06-Declarations.md#getter-setter-keyword-block) +> *协议下标声明* → [下标头](./06_Declarations.md#subscript-head) [下标结果](./06_Declarations.md#subscript-result) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [getter-setter 关键字块](./06_Declarations.md#getter-setter-keyword-block) > > 协议关联类型声明语法 > -> *协议关联类型声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07-Attributes.md#access-level-modifier)可选 **associatedtype** [类型别名](./06-Declarations.md#typealias-name) [类型继承子句](./03-Types.md#type-inheritance-clause)可选 [类型别名赋值](./06-Declarations.md#typealias-assignment)可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 +> *协议关联类型声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07_Attributes.md#access-level-modifier)可选 **associatedtype** [类型别名](./06_Declarations.md#typealias-name) [类型继承子句](./03_Types.md#type-inheritance-clause)可选 [类型别名赋值](./06_Declarations.md#typealias-assignment)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 > > 构造器声明语法 > -> *构造器声明* → [构造器头](./06_Declarations.md#initializer-head) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [参数子句](./06-Declarations.md#parameter-clause) **throws**可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [构造器主体](./06-Declarations.md#initializer-body) +> *构造器声明* → [构造器头](./06_Declarations.md#initializer-head) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [参数子句](./06_Declarations.md#parameter-clause) **throws**可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [构造器主体](./06_Declarations.md#initializer-body) > -> *构造器声明* → [构造器头](./06_Declarations.md#initializer-head) [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [参数子句](./06-Declarations.md#parameter-clause) **rethrows** [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [构造器主体](./06-Declarations.md#initializer-body) +> *构造器声明* → [构造器头](./06_Declarations.md#initializer-head) [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [参数子句](./06_Declarations.md#parameter-clause) **rethrows** [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [构造器主体](./06_Declarations.md#initializer-body) > -> *构造器头(Head)* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06-Declarations.md#declaration-modifiers)可选 **init** +> *构造器头(Head)* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06_Declarations.md#declaration-modifiers)可选 **init** > -> *构造器头(Head)* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06-Declarations.md#declaration-modifiers)可选 **init ?** +> *构造器头(Head)* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06_Declarations.md#declaration-modifiers)可选 **init ?** > -> *构造器头(Head)* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06-Declarations.md#declaration-modifiers)可选 **init !** +> *构造器头(Head)* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06_Declarations.md#declaration-modifiers)可选 **init !** > > *构造器主体* → [代码块](./06_Declarations.md#code-block) > @@ -1433,57 +1433,57 @@ > 析构器声明语法 > -> *析构器声明* → [特性](./07_Attributes.md#attributes)可选 **deinit** [代码块](./06-Declarations.md#code-block) +> *析构器声明* → [特性](./07_Attributes.md#attributes)可选 **deinit** [代码块](./06_Declarations.md#code-block) > > 扩展声明语法 > -> *扩展声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07-Attributes.md#access-level-modifier)可选 **extension** [类型标识](./03-Types.md#type-identifier) [类型继承子句](./03-Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [扩展主体](./06-Declarations.md#extension-body) +> *扩展声明* → [特性](./07_Attributes.md#attributes)可选 [访问级别修饰符](./07_Attributes.md#access-level-modifier)可选 **extension** [类型标识](./03_Types.md#type-identifier) [类型继承子句](./03_Types.md#type-inheritance-clause)可选 [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [扩展主体](./06_Declarations.md#extension-body) > > *扩展主体* → **{** [扩展成员集](./06_Declarations.md#declarations)可选 **}** > -> *扩展成员集* → [扩展成员](./06_Declarations.md#declarations) [扩展成员集](./06-Declarations.md#declarations)可选 +> *扩展成员集* → [扩展成员](./06_Declarations.md#declarations) [扩展成员集](./06_Declarations.md#declarations)可选 > -> *扩展成员* → [声明集](./06_Declarations.md#declarations) | [编译控制语句](./05-Statements.md#compiler-control-statement) +> *扩展成员* → [声明集](./06_Declarations.md#declarations) | [编译控制语句](./05_Statements.md#compiler-control-statement) > > 下标声明语法 > -> *下标声明* → [下标头](./06_Declarations.md#subscript-head) [下标结果](./06-Declarations.md#subscript-result) [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [代码块](./06-Declarations.md#code-block) +> *下标声明* → [下标头](./06_Declarations.md#subscript-head) [下标结果](./06_Declarations.md#subscript-result) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [代码块](./06_Declarations.md#code-block) > -> *下标声明* → [下标头](./06_Declarations.md#subscript-head) [下标结果](./06-Declarations.md#subscript-result) [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [getter-setter 块](./06-Declarations.md#getter-setter-block) +> *下标声明* → [下标头](./06_Declarations.md#subscript-head) [下标结果](./06_Declarations.md#subscript-result) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [getter-setter 块](./06_Declarations.md#getter-setter-block) > -> *下标声明* → [下标头](./06_Declarations.md#subscript-head) [下标结果](./06-Declarations.md#subscript-result) [泛型 where 子句](./09-Generic-Parameters-and-Arguments.md#generic-where-clause)可选 [getter-setter 关键字块](./06-Declarations.md#getter-setter-keyword-block) +> *下标声明* → [下标头](./06_Declarations.md#subscript-head) [下标结果](./06_Declarations.md#subscript-result) [泛型 where 子句](./09_Generic_Parameters_and_Arguments.md#generic-where-clause)可选 [getter-setter 关键字块](./06_Declarations.md#getter-setter-keyword-block) > -> *下标头(Head)* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06-Declarations.md#declaration-modifiers)可选 **subscript** [泛型参数子句](./09-Generic-Parameters-and-Arguments.md#generic-parameter-clause)可选 [参数子句](./06-Declarations.md#parameter-clause) +> *下标头(Head)* → [特性](./07_Attributes.md#attributes)可选 [声明修饰符集](./06_Declarations.md#declaration-modifiers)可选 **subscript** [泛型参数子句](./09_Generic_Parameters_and_Arguments.md#generic-parameter-clause)可选 [参数子句](./06_Declarations.md#parameter-clause) > -> *下标结果(Result)* → **->** [特性](./07_Attributes.md#attributes)可选 [类型](./03-Types.md#type) +> *下标结果(Result)* → **->** [特性](./07_Attributes.md#attributes)可选 [类型](./03_Types.md#type) > > 运算符声明语法 > -> *运算符声明* → [前置运算符声明](./06_Declarations.md#prefix-operator-declaration) | [后置运算符声明](./06-Declarations.md#postfix-operator-declaration) | [中置运算符声明](./06-Declarations.md#infix-operator-declaration) +> *运算符声明* → [前置运算符声明](./06_Declarations.md#prefix-operator-declaration) | [后置运算符声明](./06_Declarations.md#postfix-operator-declaration) | [中置运算符声明](./06_Declarations.md#infix-operator-declaration) > > *前置运算符声明* → **prefix** **operator** [运算符](./02_Lexical_Structure.md#operator) > > *后置运算符声明* → **postfix** **operator** [运算符](./02_Lexical_Structure.md#operator) > -> *中置运算符声明* → **infix** **operator** [运算符](./02_Lexical_Structure.md#operator) [中置运算符特性](./06-Declarations.md#infix-operator-attributes)可选 +> *中置运算符声明* → **infix** **operator** [运算符](./02_Lexical_Structure.md#operator) [中置运算符特性](./06_Declarations.md#infix-operator-attributes)可选 > > *中置运算符特性* → [优先级组名](./06_Declarations.md#precedence-group-name) > > 优先级组声明语法 > -> *优先级组声明* → **precedencegroup** [优先级组名](./06_Declarations.md#precedence-group-name) **{** [优先级组特性](./06-Declarations.md#precedence-group-attributes)可选 **}** +> *优先级组声明* → **precedencegroup** [优先级组名](./06_Declarations.md#precedence-group-name) **{** [优先级组特性](./06_Declarations.md#precedence-group-attributes)可选 **}** > -> *优先级组特性* → [优先级组属性](./06_Declarations.md#declarations) [优先级组特性](./06-Declarations.md#declarations)可选 +> *优先级组特性* → [优先级组属性](./06_Declarations.md#declarations) [优先级组特性](./06_Declarations.md#declarations)可选 > > *优先级组属性* → [优先级组关系](./06_Declarations.md#declarations) > @@ -1503,7 +1503,7 @@ > > *优先级组结合* → **associativity : none** > -> *优先级组名集* → [优先级组名](./06_Declarations.md#declarations) | [优先级组名](./06-Declarations.md#declarations) **,** [优先级组名集](./06-Declarations.md#declarations) +> *优先级组名集* → [优先级组名](./06_Declarations.md#declarations) | [优先级组名](./06_Declarations.md#declarations) **,** [优先级组名集](./06_Declarations.md#declarations) > > *优先级组名* → [标识符](./02_Lexical_Structure.md#identifier) > @@ -1517,7 +1517,7 @@ > > *声明修饰符* → [可变性修饰符](./07_Attributes.md#mutation-modifier) > -> *声明修饰符集* → [声明修饰符](./06_Declarations.md#declaration-modifier) [声明修饰符集](./06-Declarations.md#declaration-modifiers)可选 +> *声明修饰符集* → [声明修饰符](./06_Declarations.md#declaration-modifier) [声明修饰符集](./06_Declarations.md#declaration-modifiers)可选 > > *访问级别修饰符* → **private** | **private(set)** > @@ -1536,15 +1536,15 @@ > 属性语法 > -> *属性* → **@** [属性名](./07_Attributes.md#attribute-name) [属性参数子句](./07-Attributes.md#attribute-argument-clause)可选 +> *属性* → **@** [属性名](./07_Attributes.md#attribute-name) [属性参数子句](./07_Attributes.md#attribute-argument-clause)可选 > > *属性名* → [标识符](./02_Lexical_Structure.md#identifier) > > *属性参数子句* → **{** [平衡令牌集](./07_Attributes.md#balanced-tokens)可选 **}** > -> *属性(Attributes)集* → [属性](./07_Attributes.md#attribute) [特性](./07-Attributes.md#attributes)可选 +> *属性(Attributes)集* → [属性](./07_Attributes.md#attribute) [特性](./07_Attributes.md#attributes)可选 > -> *平衡令牌集* → [平衡令牌](./07_Attributes.md#balanced-token) [平衡令牌集](./07-Attributes.md#balanced-tokens)可选 +> *平衡令牌集* → [平衡令牌](./07_Attributes.md#balanced-token) [平衡令牌集](./07_Attributes.md#balanced-tokens)可选 > > *平衡令牌* → **(** [平衡令牌集](./07_Attributes.md#balanced-tokens)可选 **)** > @@ -1562,13 +1562,13 @@ > 模式语法 > -> *模式* → [通配符模式](./08_Patterns.md#wildcard-pattern) [类型注解](./03-Types.md#type-annotation)可选 +> *模式* → [通配符模式](./08_Patterns.md#wildcard-pattern) [类型注解](./03_Types.md#type-annotation)可选 > -> *模式* → [标识符模式](./08_Patterns.md#identifier-pattern) [类型注解](./03-Types.md#type-annotati Value Bindingon )可选 +> *模式* → [标识符模式](./08_Patterns.md#identifier-pattern) [类型注解](./03_Types.md#type-annotati Value Bindingon )可选 > > *模式* → [值绑定模式](./08_Patterns.md#value-binding-pattern) > -> *模式* → [元组模式](./08_Patterns.md#tuple-pattern) [类型注解](./03-Types.md#type-annotation)可选 +> *模式* → [元组模式](./08_Patterns.md#tuple-pattern) [类型注解](./03_Types.md#type-annotation)可选 > > *模式* → [枚举 case 模式](./08_Patterns.md#enum-case-pattern) > @@ -1597,7 +1597,7 @@ > 值绑定模式语法 > -> *值绑定模式* → **var** [模式](./08_Patterns.md#pattern) | **let** [模式](./08-Patterns.md#pattern) +> *值绑定模式* → **var** [模式](./08_Patterns.md#pattern) | **let** [模式](./08_Patterns.md#pattern) > @@ -1606,16 +1606,16 @@ > > *元组模式* → **(** [元组模式元素集](./08_Patterns.md#tuple-pattern-element-list)可选 **)** > -> *元组模式元素集* → [元组模式元素](./08_Patterns.md#tuple-pattern-element) | [元组模式元素](./08-Patterns.md#tuple-pattern-element) **,** [元组模式元素集](./08-Patterns.md#tuple-pattern-element-list) +> *元组模式元素集* → [元组模式元素](./08_Patterns.md#tuple-pattern-element) | [元组模式元素](./08_Patterns.md#tuple-pattern-element) **,** [元组模式元素集](./08_Patterns.md#tuple-pattern-element-list) > -> *元组模式元素* → [模式](./08_Patterns.md#pattern) | [标识符](./02-Lexical-Structure.md#identifier) **:** [模式](./08-Patterns.md#pattern) +> *元组模式元素* → [模式](./08_Patterns.md#pattern) | [标识符](./02_Lexical_Structure.md#identifier) **:** [模式](./08_Patterns.md#pattern) > > 枚举 case 模式语法 > -> *enum-case-pattern* → [类型标识](./03_Types.md#type-identifier)可选 **.** [枚举 case 名](./06-Declarations.md#enum-case-name) [元组模式](./08-Patterns.md#tuple-pattern)可选 +> *enum-case-pattern* → [类型标识](./03_Types.md#type-identifier)可选 **.** [枚举 case 名](./06_Declarations.md#enum-case-name) [元组模式](./08_Patterns.md#tuple-pattern)可选 > @@ -1628,11 +1628,11 @@ > 类型转换模式语法 > -> *类型转换模式* → [is 模式](./08_Patterns.md#is-pattern) | [as 模式](./08-Patterns.md#as-pattern) +> *类型转换模式* → [is 模式](./08_Patterns.md#is-pattern) | [as 模式](./08_Patterns.md#as-pattern) > > *is 模式* → **is** [类型](./03_Types.md#type) > -> *as 模式* → [模式](./08_Patterns.md#pattern) **as** [类型](./03-Types.md#type) +> *as 模式* → [模式](./08_Patterns.md#pattern) **as** [类型](./03_Types.md#type) > @@ -1649,25 +1649,25 @@ > > *泛型参数子句* → **<** [泛型参数集](./09_Generic_Parameters_and_Arguments.md#generic-parameter-list) **>** > -> *泛型参数集* → [泛型参数](./09_Generic_Parameters_and_Arguments.md#generic-parameter) | [泛形参数](./09-Generic-Parameters-and-Arguments.md#generic-parameter) **,** [泛型参数集](./09-Generic-Parameters-and-Arguments.md#generic-parameter-list) +> *泛型参数集* → [泛型参数](./09_Generic_Parameters_and_Arguments.md#generic-parameter) | [泛形参数](./09_Generic_Parameters_and_Arguments.md#generic-parameter) **,** [泛型参数集](./09_Generic_Parameters_and_Arguments.md#generic-parameter-list) > > *泛形参数* → [类型名称](./03_Types.md#type-name) > -> *泛形参数* → [类型名称](./03_Types.md#type-name) **:** [类型标识](./03-Types.md#type-identifier) +> *泛形参数* → [类型名称](./03_Types.md#type-name) **:** [类型标识](./03_Types.md#type-identifier) > -> *泛形参数* → [类型名称](./03_Types.md#type-name) **:** [协议合成类型](./03-Types.md#protocol-composition-type) +> *泛形参数* → [类型名称](./03_Types.md#type-name) **:** [协议合成类型](./03_Types.md#protocol-composition-type) > > *泛型 where 子句* → **where** [约束集](./09_Generic_Parameters_and_Arguments.md#requirement-list) > -> *约束集* → [约束](./09_Generic_Parameters_and_Arguments.md#requirement) | [约束](./09-Generic-Parameters-and-Arguments.md#requirement) **,** [约束集](./09-Generic-Parameters-and-Arguments.md#requirement-list) +> *约束集* → [约束](./09_Generic_Parameters_and_Arguments.md#requirement) | [约束](./09_Generic_Parameters_and_Arguments.md#requirement) **,** [约束集](./09_Generic_Parameters_and_Arguments.md#requirement-list) > -> *约束* → [一致性约束](./09_Generic_Parameters_and_Arguments.md#conformance-requirement) | [同类型约束](./09-Generic-Parameters-and-Arguments.md#same-type-requirement) +> *约束* → [一致性约束](./09_Generic_Parameters_and_Arguments.md#conformance-requirement) | [同类型约束](./09_Generic_Parameters_and_Arguments.md#same-type-requirement) > -> *一致性约束* → [类型标识](./03_Types.md#type-identifier) **:** [类型标识](./03-Types.md#type-identifier) +> *一致性约束* → [类型标识](./03_Types.md#type-identifier) **:** [类型标识](./03_Types.md#type-identifier) > -> *一致性约束* → [类型标识](./03_Types.md#type-identifier) **:** [协议合成类型](./03-Types.md#protocol-composition-type) +> *一致性约束* → [类型标识](./03_Types.md#type-identifier) **:** [协议合成类型](./03_Types.md#protocol-composition-type) > -> *同类型约束* → [类型标识](./03_Types.md#type-identifier) **==** [类型](./03-Types.md#type-identifier) +> *同类型约束* → [类型标识](./03_Types.md#type-identifier) **==** [类型](./03_Types.md#type-identifier) > @@ -1676,6 +1676,6 @@ > > *泛型实参子句* → **<** [泛型实参集](./09_Generic_Parameters_and_Arguments.md#generic-argument-list) **>** > -> *泛型实参集* → [泛型实参](./09_Generic_Parameters_and_Arguments.md#generic-argument) | [泛形实参](./09-Generic-Parameters-and-Arguments.md#generic-argument) **,** [泛型实参集](./09-Generic-Parameters-and-Arguments.md#generic-argument-list) +> *泛型实参集* → [泛型实参](./09_Generic_Parameters_and_Arguments.md#generic-argument) | [泛形实参](./09_Generic_Parameters_and_Arguments.md#generic-argument) **,** [泛型实参集](./09_Generic_Parameters_and_Arguments.md#generic-argument-list) > > *泛形实参* → [类型](./03_Types.md#type) \ No newline at end of file diff --git a/source/04_revision_history/04_revision_history.md b/source/04_revision_history/04_revision_history.md index db159b9e..85e6a950 100644 --- a/source/04_revision_history/04_revision_history.md +++ b/source/04_revision_history/04_revision_history.md @@ -10,7 +10,7 @@ ### 2019-09-10 * 更新至 Swift 5.1。 -* 在 [不透明类型](../02_language_guide/27_Opaque_Types.md) 篇章中新增了有关函数返回值遵循指定协议,而不需要提供指定返回类型的内容。 +* 在 [不透明类型](../02_language_guide/23_Opaque_Types.md) 篇章中新增了有关函数返回值遵循指定协议,而不需要提供指定返回类型的内容。 * 在 [属性包装器](../02_language_guide/10_Properties.md#property-wrappers) 章节中新增了有关属性包装器的内容。 * 在 [冻结](../03_language_reference/07_Attributes.md#frozen) 章节中新增了有关因库演变而需要的枚举和结构体冻结。 * 新增 [隐式返回的函数](../02_language_guide/06_Functions.md#functions-with-an-implicit-return) 和 [简化 Getter 声明](../02_language_guide/10_Properties.md#shorthand-getter-declaration) 章节,其中包含函数省略 `return` 的内容。 @@ -24,9 +24,9 @@ ### 2019-03-25 * 更新至 Swift 5。 -* 新增 [拓展字符串分隔符](../02_language_guide/03_Strings_And_Characters.md#extended-string-delimiters) 章节。更新 [字符串字面量](../03-language-reference/03-Lexical-Structure.md#string-literal) 章节,拓展有关字符串分隔符的内容。 +* 新增 [拓展字符串分隔符](../02_language_guide/03_Strings_and_Characters.md#extended-string-delimiters) 章节。更新 [字符串字面量](../03_language_reference/02_Lexical_Structure.md#string-literal) 章节,拓展有关字符串分隔符的内容。 * 新增 [动态调用](../03_language_reference/07_Attributes.md#dynamiccallable) 章节,其中包含使用 `dynamicCallable` 属性动态调用实例作为函数的内容。 -* 新增 [unknown](../03_language_reference/07_Attributes.md#unknown) 和 [未来枚举匹配](../03-language-reference/05-Statements.md#future-case2) 章节,其中包含了使用 `unknown` 来处理未来枚举可能发生改变的情形。 +* 新增 [unknown](../03_language_reference/07_Attributes.md#unknown) 和 [未来枚举匹配](../03_language_reference/05_Statements.md#future-case) 章节,其中包含了使用 `unknown` 来处理未来枚举可能发生改变的情形。 * 在 [Key-Path 表达式](../03_language_reference/04_Expressions.md#key-path-expression) 章节新增了有关标示 key path (\\.self) 的内容。 * 在 [可选编译块](../03_language_reference/05_Statements.md#Conditional-Compilation-Block) 章节新增了有关小于比较符 `<` 的内容。 @@ -44,7 +44,7 @@ * 更新至 Swift 4.1。 * 在 [等价运算符](../02_language_guide/27_Advanced_Operators.md#equivalence-operators) 章节新增了有关等价运算符的合成实现的内容。 -* 在 [声明](../03_language_reference/06_Declarations.md) 篇章中 [申明拓展](../03_language_reference/06_Declarations.md#extension-declaration) 章节和 [协议](../02-language-guide/21-Protocols.md) 篇章中 [有条件地遵循协议](../02-language-guide/21-Protocols.md#Conditionally-Conforming-to-a-Protocol) 章节新增了有关协议有条件遵循的内容。 +* 在 [声明](../03_language_reference/06_Declarations.md) 篇章中 [声明拓展](../03_language_reference/06_Declarations.md#extension-declaration) 章节和 [协议](../02_language_guide/21_Protocols.md) 篇章中 [有条件地遵循协议](../02_language_guide/21_Protocols.md#Conditionally-Conforming-to-a-Protocol) 章节新增了有关协议有条件遵循的内容。 * 在 [关联类型约束中使用协议](../02_language_guide/22_Generics.md#using-a-protocol-in-its-associated-types-constraints) 章节中新增了有关递归协议约束的内容。 * 在 [条件编译块](../03_language_reference/05_Statements.md#Conditional-Compilation-Block) 章节中新增了有关 `canImport()` 和 `targetEnvironment()` 平台条件的内容。 @@ -56,21 +56,21 @@ ### 2017-09-19 * 更新至 Swift 4.0。 -* 在 [内存安全](../02_language_guide/24_MemorySafety.md) 章节新增了有关内存互斥访问的内容。 +* 在 [内存安全](../02_language_guide/25_Memory_Safety.md) 章节新增了有关内存互斥访问的内容。 * 新增 [带有泛型 Where 子句联类型](../02_language_guide/22_Generics.md#associated-types-with-a-generic-where-clause) 章节,现在可以使用泛型 `where` 子句约束关联类型。 -* 在 [字符串和字符](../02_language_guide/03_Strings_And_Characters.md) 篇章中 [字面量](../02_language_guide/03_Strings_And_Characters.md#string-literals) 章节以及 [词法结构](../03-language-reference/02-Lexical-Structure.md) 篇章的 [字符串字面量](../03-language-reference/02-Lexical-Structure.md#string-literal) 章节中新增了有关多行字符串字面量的内容。 +* 在 [字符串和字符](../02_language_guide/03_Strings_and_Characters.md) 篇章中 [字面量](../02_language_guide/03_Strings_and_Characters.md#string-literals) 章节以及 [词法结构](../03_language_reference/02_Lexical_Structure.md) 篇章的 [字符串字面量](../03_language_reference/02_Lexical_Structure.md#string-literal) 章节中新增了有关多行字符串字面量的内容。 * 更新 [声明属性](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 中 `objc` 属性的讨论,现在该属性会在更少的位置被推断出来。 * 新增 [范型下标](../02_language_guide/22_Generics.md#generic-subscripts) 章节,现在下标也支持范型特性了。 -* 更新 [协议](../02_language_guide/21_Protocols.md) 篇章中 [协议组合](../02_language_guide/21_Protocols.md#protocol-composition) 章节和 [类型](../03-language-reference/03-Types.md) 篇章中 [协议组合类型](../03-language-reference/03-Types.md#protocol-composition-type-h) 章节的讨论,现在协议组合类型支持进行父类约束了。 +* 更新 [协议](../02_language_guide/21_Protocols.md) 篇章中 [协议组合](../02_language_guide/21_Protocols.md#protocol-composition) 章节和 [类型](../03_language_reference/03_Types.md) 篇章中 [协议组合类型](../03_language_reference/03_Types.md#protocol-composition-type-h) 章节的讨论,现在协议组合类型支持进行父类约束了。 * 更新 [拓展声明](../03_language_reference/06_Declarations.md#extension-declaration) 中有关协议扩展的讨论,现在它们不支持 `final` 特性了。 -* 在 [断言和前置条件](../02_language_guide/01_TheBasics.md#assertions-and-preconditions) 章节中新增了部分前置条件和致命错误的内容。 +* 在 [断言和前置条件](../02_language_guide/01_The_Basics.md#assertions-and-preconditions) 章节中新增了部分前置条件和致命错误的内容。 ### 2017-03-27 * 更新至 Swift 3.1。 * 新增 [范型 Where 子句扩展](../02_language_guide/22_Generics.md#extensions-with-a-generic-where-clause) 章节,包含需要的扩展内容。 * 在 [For-In 循环](../02_language_guide/05_Control_Flow.md#for-in-loops) 章节中新增了区间迭代的例子。 -* 在 [到可失败构造器](http://typora-app/02_language_guide/14_Initialization.md#failable-initializers) 章节中新增了可失败数值转换的例子。 +* 在 [可失败构造器](../02_language_guide/14_Initialization.md#failable-initializers) 章节中新增了可失败数值转换的例子。 * 在 [声明特性](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 章节中新增了有关使用 Swift 语言版本的 `available` 特性的内容 。 * 更新 [函数类型](../03_language_reference/03_Types.md#function-type-h) 章节中的讨论,注意在写函数类型时不允许使用参数标签。 * 更新 [条件编译块](../03_language_reference/05_Statements.md#Conditional-Compilation-Block) 章节中的 Swift 语言版本号的讨论,现在可以使用可选的补丁版本号。 @@ -92,15 +92,15 @@ * 更新 [高级操作符](../02_language_guide/27_Advanced_Operators.md) 篇章中有关操作符的讨论,现在你可以作为类型函数来实现,替代之前的全局函数实现方式。 * 在 [访问控制](../02_language_guide/26_Access_Control.md) 章节中新增有关对新的访问级别描述符 `open` 和 `fileprivate` 的内容。 * 更新 [函数声明](../03_language_reference/06_Declarations.md#function-declaration) 章节中有关 `inout` 的讨论,注意它现在出现在参数类型的前面,而不是在参数名称的前面。 -* 更新 [逃逸闭包](../02_language_guide/07_Closures.md#escaping-closures) 和 [自动闭包](../02-language-guide/07-Closures.md#autoclosures) 章节还有 [属性](../03-language-reference/07-Attributes.md) 篇章中有关 `@noescape` 和 `@autoclosure` 的讨论,现在他们是类型属性,而不是定义属性。 -* 在 [高级操作符](../02_language_guide/27_Advanced_Operators.md) 篇章中 [自定义中缀操作符的优先级](./02_language_guide/27_Advanced_Operators.md#precedence-and-associativity-for-custom-infix-operators) 章节和 [定义](../03-language-reference/06-Declarations.md) 篇章中 [优先级组声明](../03-language-reference/06-Declarations.md#precedence-group-declaration-modifiers) 章节中新增了有关操作符优先级组的内容。 +* 更新 [逃逸闭包](../02_language_guide/07_Closures.md#escaping-closures) 和 [自动闭包](../02_language_guide/07_Closures.md#autoclosures) 章节还有 [属性](../03_language_reference/07_Attributes.md) 篇章中有关 `@noescape` 和 `@autoclosure` 的讨论,现在他们是类型属性,而不是定义属性。 +* 在 [高级操作符](../02_language_guide/27_Advanced_Operators.md) 篇章中 [自定义中缀操作符的优先级](./02_language_guide/27_Advanced_Operators.md#precedence-and-associativity-for-custom-infix-operators) 章节和 [定义](../03_language_reference/06_Declarations.md) 篇章中 [优先级组声明](../03_language_reference/06_Declarations.md#precedence-group-declaration-modifiers) 章节中新增了有关操作符优先级组的内容。 * 更新一些讨论,使用 macOS 替换掉 OS X, Error 替换掉 ErrorProtocol。更新一些协议名称,比如使用 ExpressibleByStringLiteral 替换掉 StringLiteralConvertible。 -* 更新 [泛型](../02_language_guide/22_Generics.md) 篇章中 [泛型 Where 语句](../02_language_guide/22_Generics.md#extensions-with-a-generic-where-clause) 章节和 [泛型形参和实参](../03-language-reference/09-Generic-Parameters-And-Arguments.md) 篇章的讨论,现在泛型的 where 语句写在一个声明的最后。 +* 更新 [泛型](../02_language_guide/22_Generics.md) 篇章中 [泛型 Where 语句](../02_language_guide/22_Generics.md#extensions-with-a-generic-where-clause) 章节和 [泛型形参和实参](../03_language_reference/09_Generic_Parameters_and_Arguments.md) 篇章的讨论,现在泛型的 where 语句写在一个声明的最后。 * 更新 [逃逸闭包](../02_language_guide/07_Closures.md#escaping-closures) 章节中的讨论,现在闭包默认为非逃逸的。 -* 更新 [基础部分](../02_language_guide/01_TheBasics.md) 篇章中 [可选绑定](../02_language_guide/01_TheBasics.md#optional-binding) 章节和 [语句](../03-language-reference/05-Statements.md) 篇章中 [While 语句](../03-language-reference/05-Statements.md#while-statement) 章节中的讨论,现在 if,`while` 和 `guard` 语句使用逗号分隔条件列表,不需要使用 `where` 语句。 -* 在 [控制流](../02_language_guide/05_Control_Flow.md) 篇章中 [Switch](../02_language_guide/05_Control_Flow.md#switch) 章节和 [语句](../03-language-reference/05-Statements.md) 篇章中 [Switch 语句](../03-language-reference/05-Statements.md#switch-statement) 章节中新增了 switch cases 可以使用多模式的内容。 +* 更新 [基础部分](../02_language_guide/01_The_Basics.md) 篇章中 [可选绑定](../02_language_guide/01_The_Basics.md#optional-binding) 章节和 [语句](../03_language_reference/05_Statements.md) 篇章中 [While 语句](../03_language_reference/05_Statements.md#while-statement) 章节中的讨论,现在 if,`while` 和 `guard` 语句使用逗号分隔条件列表,不需要使用 `where` 语句。 +* 在 [控制流](../02_language_guide/05_Control_Flow.md) 篇章中 [Switch](../02_language_guide/05_Control_Flow.md#switch) 章节和 [语句](../03_language_reference/05_Statements.md) 篇章中 [Switch 语句](../03_language_reference/05_Statements.md#switch-statement) 章节中新增了 switch cases 可以使用多模式的内容。 * 更新 [函数类型](../03_language_reference/03_Types.md#function-type-h) 章节有关现在函数参数标签不包含在函数类型中的讨论。 -* 更新 [协议](../02_language_guide/21_Protocols.md) 篇章中 [协议组合](../02_language_guide/21_Protocols.md#protocol-composition) 章节和 [类型](../03-language-reference/03-Types.md) 篇章中 [协议组合类型](../03-language-reference/03-Types.md#protocol-composition-type-h) 章节中有关使用新的 Protocol1 & Protocol2 语法的内容。 +* 更新 [协议](../02_language_guide/21_Protocols.md) 篇章中 [协议组合](../02_language_guide/21_Protocols.md#protocol-composition) 章节和 [类型](../03_language_reference/03_Types.md) 篇章中 [协议组合类型](../03_language_reference/03_Types.md#protocol-composition-type-h) 章节中有关使用新的 Protocol1 & Protocol2 语法的内容。 * 更新动态类型表达式章节中使用新的 `type(of:)` 表达式的讨论。 * 更新 [行控制表达式](../03_language_reference/05_Statements.md#line-control-statement) 章节中使用 `#sourceLocation(file:line:)` 表达式的讨论。 * 更新 [永不返回函数](../03_language_reference/06_Declarations.md#functions-that-never-return) 章节中使用 新的 `Never` 类型的讨论。 @@ -125,15 +125,15 @@ * 在 [编译配置语句](../03_language_reference/05_Statements.md#Conditional-Compilation-Block) 章节新增了中有关如何根据 Swift 版本进行条件编译。 * 在 [显示成员表达式](../03_language_reference/04_Expressions.md#explicit-member-expression) 章节中新增了有关如何区分只有参数名不同的方法和构造器的内容。 * 在 [选择器表达式](../03_language_reference/04_Expressions.md#selector-expression7) 章节中新增了了针对 Objective-C 选择器的 `#selector` 语法。 -* 更新 [关联类型](../02_language_guide/22_Generics.md#associated-types) 和 [协议关联类型声明](../03-language-reference/06-Declarations.md#protocol-associated-type-declaration) 章节中有关使用 `associatedtype` 关键词修饰关联类型的讨论。 +* 更新 [关联类型](../02_language_guide/22_Generics.md#associated-types) 和 [协议关联类型声明](../03_language_reference/06_Declarations.md#protocol-associated-type-declaration) 章节中有关使用 `associatedtype` 关键词修饰关联类型的讨论。 * 更新 [可失败构造器](../02_language_guide/14_Initialization.md#failable-initializers) 章节中有关当构造器在实例完全初始化之前返回 `nil` 的相关内容。 -* 在 [比较运算符](../02_language_guide/BasicOperators.md#comparison-operators) 章节中新增了比较元组的内容。 +* 在 [比较运算符](../02_language_guide/02_Basic_Operators.md#comparison-operators) 章节中新增了比较元组的内容。 * 在 [关键字和标点符号](../03_language_reference/02_Lexical_Structure.md#keywords-and-punctuation) 章节中新增了使用关键字作为外部参数名的内容。 * 更新 [声明特性](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 章节中有关 `@objc` 特性的讨论,并指出枚举和枚举用例。 * 更新 [操作符](../03_language_reference/02_Lexical_Structure.md#operator) 章节中对于自定义运算符的包含了 `.` 的讨论。 * 在 [重新抛出错误的函数和方法](../03_language_reference/06_Declarations.md#rethrowing-functions-and-methods) 章节中新增了一处说明,重新抛出错误函数不能直接抛出错误。 * 在 [属性观察器](../02_language_guide/10_Properties.md#property-observers) 章节中新增了一处说明,当作为 in-out 参数传递属性时,属性观察器的调用行为。 -* 在 [Swift 初见](./03_a_swift_tour.md) 篇章中新增了错误处理的章节。 +* 在 [Swift 初见](../01_welcome_to_swift/03_a_swift_tour.md) 篇章中新增了错误处理的章节。 * 更新 [弱引用](../02_language_guide/24_Automatic_Reference_Counting.md#weak-references) 章节中的图片用以更清楚的展示重新分配过程。 * 删除 C 语言风格的 `for` 循环,`++` 前缀和后缀运算符,以及 `--` 前缀和后缀运算符。 * 删除对变量函数参数和柯里化函数的特殊语法的讨论。 @@ -141,38 +141,38 @@ ### 2015-10-20 * 更新至 Swift 2.1。 -* 更新 [字符串插值](../02_language_guide/03_Strings_And_Characters.md#string-interpolation) 和 [字符串字面量](../03-language-reference/02-Lexical-Structure.md#string-literal) 章节,现在字符串插值可包含字符串字面量。 +* 更新 [字符串插值](../02_language_guide/03_Strings_and_Characters.md#string-interpolation) 和 [字符串字面量](../03_language_reference/02_Lexical_Structure.md#string-literal) 章节,现在字符串插值可包含字符串字面量。 * 在 [逃逸闭包](../02_language_guide/07_Closures.md#escaping-closures) 章节中新增了有关 `@noescape` 属性的相关内容。 -* 更新 [声明特性](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 和 [编译配置语句](../03-language-reference/05-Statements.md#Conditional-Compilation-Block) 章节中与 tvOS 相关的内容。 +* 更新 [声明特性](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 和 [编译配置语句](../03_language_reference/05_Statements.md#Conditional-Compilation-Block) 章节中与 tvOS 相关的内容。 * 在 [In-Out 参数](../03_language_reference/06_Declarations.md#in-out-parameters) 章节中新增了与 in-out 参数行为相关的内容。 * 在 [捕获列表](../03_language_reference/04_Expressions.md#capture-lists) 章节新增了有关指定闭包捕获列表被捕获时捕获值的相关内容。 * 更新 [可选链式调用访问属性](../02_language_guide/16_Optional_Chaining.md#accessing-properties-through-optional-chaining) 章节,阐明了如何通过可选链式调用进行赋值。 * 改进 [自动闭包](../02_language_guide/07_Closures.md#autoclosures) 章节中对自闭包的讨论。 -* 在 [Swift 初见](./03_a_swift_tour.md) 篇章中新增了一个使用 `??` 操作符的例子。 +* 在 [Swift 初见](../01_welcome_to_swift/03_a_swift_tour.md) 篇章中新增了一个使用 `??` 操作符的例子。 ### 2015-09-16 * 更新至 Swift 2.0。 -* 在 [错误处理](../02_language_guide/17_Error_Handling.md) 篇章中新增了有关错误处理的相关内容,包括 [Do 语句](../03_language_reference/05_Statements.md#do-statement)、 [Throw 语句](../03-language-reference/05-Statements.md#throw-statement)、 [Defer 语句](../03-language-reference/05-Statements.md##defer-statements) 以及 [try 运算符](../03-language-reference/04-Expressions.md#try-operator)。 +* 在 [错误处理](../02_language_guide/17_Error_Handling.md) 篇章中新增了有关错误处理的相关内容,包括 [Do 语句](../03_language_reference/05_Statements.md#do-statement)、 [Throw 语句](../03_language_reference/05_Statements.md#throw-statement)、 [Defer 语句](../03_language_reference/05_Statements.md##defer-statements) 以及 [try 运算符](../03_language_reference/04_Expressions.md#try-operator)。 * 更新 [错误表示和抛出](../02_language_guide/17_Error_Handling.md#representing-and-throwing-errors) 章节,现在所有类型都可以遵循 `ErrorType` 协议了。 * 在 [将错误装换成可选值](../02_language_guide/17_Error_Handling.md#converting-errors-to-optional-values) 篇章增加了 `try?` 关键字相关内容。 -* 在 [枚举](../02_language_guide/08_Enumerations.md) 篇章的 [递归枚举](../02_language_guide/08_Enumerations.md#recursive-enumerations) 章节以及以及 [声明](../03-language-reference/06-Declarations.md) 篇章的 [任意类型用例的枚举](../03-language-reference/06-Declarations.md#enumerations-with-cases-of-any-type) 章节中新增了递归枚举相关内容。 -* 在 [控制流](../02_language_guide/05_Control_Flow.md) 篇章的 [API 可用性检查](../02_language_guide/05_Control_Flow.md#checking-api-availability) 章节和 [语句](../03-language-reference/05-Statements.md) 篇章的 [可用性条件](../03-language-reference/05-Statements.md#availability-condition) 章节中新增了有关 API 可用性检查相关的内容。 -* 在 [控制流](../02_language_guide/05_Control_Flow.md) 篇章的 [尽早退出](../02_language_guide/05_Control_Flow.md#early-exit) 章节和 [语句](../03-language-reference/05-Statements.md) 篇章的 [Guard 语句](../03-language-reference/05-Statements.md#guard-statement) 章节新增了与 `guard` 语句相关的内容。 +* 在 [枚举](../02_language_guide/08_Enumerations.md) 篇章的 [递归枚举](../02_language_guide/08_Enumerations.md#recursive-enumerations) 章节以及以及 [声明](../03_language_reference/06_Declarations.md) 篇章的 [任意类型用例的枚举](../03_language_reference/06_Declarations.md#enumerations-with-cases-of-any-type) 章节中新增了递归枚举相关内容。 +* 在 [控制流](../02_language_guide/05_Control_Flow.md) 篇章的 [API 可用性检查](../02_language_guide/05_Control_Flow.md#checking-api-availability) 章节和 [语句](../03_language_reference/05_Statements.md) 篇章的 [可用性条件](../03_language_reference/05_Statements.md#availability-condition) 章节中新增了有关 API 可用性检查相关的内容。 +* 在 [控制流](../02_language_guide/05_Control_Flow.md) 篇章的 [尽早退出](../02_language_guide/05_Control_Flow.md#early-exit) 章节和 [语句](../03_language_reference/05_Statements.md) 篇章的 [Guard 语句](../03_language_reference/05_Statements.md#guard-statement) 章节新增了与 `guard` 语句相关的内容。 * 在 [协议](../02_language_guide/21_Protocols.md) 篇章中 [协议扩展](../02_language_guide/21_Protocols.md#protocol-extensions) 章节中新增了有关协议扩展的内容。 * 在 [访问控制](../02_language_guide/26_Access_Control.md) 篇章的 [单元测试 target 的访问级别](../02_language_guide/26_Access_Control.md#access-levels-for-unit-test-targets) 章节中新增了有关单元测试访问控制相关的内容。 * 在 [模式](../03_language_reference/08_Patterns.md) 篇章的 [可选模式](../03_language_reference/08_Patterns.md#optional-pattern) 章节中新增了可选模式相关内容。 * 更新 [Repeat-While](../02_language_guide/05_Control_Flow.md#repeat-while) 章节中有关 `repeat-while` 循环相关的内容。 -* 更新 [字符串和字符](../02_language_guide/03_Strings_And_Characters.md) 章节,现在 `String` 类型在 Swift 标准库中不再遵循 `CollectionType` 协议。 -* 在 [常量与变量打印](../02_language_guide/01_TheBasics.md#printing) 章节中新增了新 Swift 标准库中有关 `print(-:separator:terminator) ` 相关内容。 -* 在 [枚举](../02_language_guide/08_Enumerations.md) 篇章的 [原始值的隐式赋值](../02_language_guide/08_Enumerations.md#implicitly-assigned-raw-values) 章节和 [声明](../03-language-reference/06-Declarations.md) 篇章的 [包含原始值类型的枚举](../03-language-reference/06-Declarations.md#enumerations-with-cases-of-a-raw-value-type) 章节中新增了有关包含 `String` 原始值的枚举用例的行为相关内容。 +* 更新 [字符串和字符](../02_language_guide/03_Strings_and_Characters.md) 章节,现在 `String` 类型在 Swift 标准库中不再遵循 `CollectionType` 协议。 +* 在 [常量与变量打印](../02_language_guide/01_The_Basics.md#printing) 章节中新增了新 Swift 标准库中有关 `print(-:separator:terminator) ` 相关内容。 +* 在 [枚举](../02_language_guide/08_Enumerations.md) 篇章的 [原始值的隐式赋值](../02_language_guide/08_Enumerations.md#implicitly-assigned-raw-values) 章节和 [声明](../03_language_reference/06_Declarations.md) 篇章的 [包含原始值类型的枚举](../03_language_reference/06_Declarations.md#enumerations-with-cases-of-a-raw-value-type) 章节中新增了有关包含 `String` 原始值的枚举用例的行为相关内容。 * 在 [自动闭包](../02_language_guide/07_Closures.md#autoclosures) 章节中新增了有关 `@autoclosure` 特性的相关内容,包括它的 `@autoclosure(escaping)` 形式。 * 更新 [声明特性](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 章节中有关 `@avaliable` 和 `warn-unused-result` 特性的相关内容。 * 更新 [类型特性](../03_language_reference/07_Attributes.md#type-attributes) 章节中有关 `@convention` 特性的相关内容。 -* 在 [可选绑定](../02_language_guide/01_TheBasics.md#optional-binding) 章节中新增了有关使用 `where` 子句进行多可选绑定的相关内容。 +* 在 [可选绑定](../02_language_guide/01_The_Basics.md#optional-binding) 章节中新增了有关使用 `where` 子句进行多可选绑定的相关内容。 * 在 [字符串字面量](../03_language_reference/02_Lexical_Structure.md#string-literal) 章节中新增了有关在编译时使用 `+` 运算符拼接字符串字面量的相关内容。 * 在 [元类型](../03_language_reference/03_Types.md#metatype-type-h) 章节中新增了有关元类型值的比较和使用它们通过构造器表达式构造实例相关内容。 -* 在 [断言调试](../02_language_guide/01_TheBasics.md#debugging-with-assertions) 章节中新增了一处说明,有关用户定义断言何时会失效。 +* 在 [断言调试](../02_language_guide/01_The_Basics.md#debugging-with-assertions) 章节中新增了一处说明,有关用户定义断言何时会失效。 * 更新 [声明特性](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 章节中对 `@NSManaged` 特性的讨论,现在这个特性可以被应用到一个确定实例方法。 * 更新 [可变参数](../02_language_guide/06_Functions.md#variadic-parameters) 章节,现在可变参数可以声明在函数参数列表的任意位置中。 * 在 [重写可失败构造器](../02_language_guide/14_Initialization.md#overriding-a-failable-initializer) 章节中新增了有关非可失败构造器相当于一个可失败构造器通过父类构造器的结果进行强制拆包的相关内容。 @@ -184,35 +184,35 @@ * 更新 [类型特性](../02_language_guide/10_Properties.md#type-properties) 章节,提到了存储型特性其实是懒加载。 * 更新 [捕获类型](../02_language_guide/07_Closures.md#capturing-values) 章节,阐明了变量和常量在闭包中如何被捕获。 * 更新 [声明特性](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 章节,用以描述何时在类中使用 `@objc` 关键字。 -* 在 [错误处理](../02_language_guide/17_Error_Handling.md#handling-errors) 章节中新增了一处说明,有关执行 `throw` 语句的性能。在 [Do 语句](../03-language-reference/05-Statements.md#do-statement) 章节的 do 语句部分也新增了类似内容。 +* 在 [错误处理](../02_language_guide/17_Error_Handling.md#handling-errors) 章节中新增了一处说明,有关执行 `throw` 语句的性能。在 [Do 语句](../03_language_reference/05_Statements.md#do-statement) 章节的 do 语句部分也新增了类似内容。 * 更新 [类型特性](../02_language_guide/10_Properties.md#type-properties) 章节中有关类、结构体和枚举的存储型和计算型特性相关的内容。 * 更新 [Break 语句](../03_language_reference/05_Statements.md#break-statement) 章节中有关带标签的 break 语句相关内容。 * 在 [属性观察器](../02_language_guide/10_Properties.md#property-observers) 章节更新了一处说明,用来明确 `willSet` 和 `didSet` 观察器的行为。 * 在 [访问级别](../02_language_guide/26_Access_Control.md#access-levels) 章节新增了有关 `private` 作用域的相关内容说明。 * 在 [弱引用](../02_language_guide/24_Automatic_Reference_Counting.md#weak-references) 章节新增了有关弱应用在垃圾回收系统和 ARC 之间的区别的说明。 -* 更新 [字符串字面量中特殊字符](../02_language_guide/03_Strings_And_Characters.md#special-characters-in-string-literals) 章节,对 Unicode 标量更精确定义。 +* 更新 [字符串字面量中特殊字符](../02_language_guide/03_Strings_and_Characters.md#special-characters-in-string-literals) 章节,对 Unicode 标量更精确定义。 ### 2015-04-08 * 更新至 Swift 1.2。 -* Swift 现在自身提供了一个 `Set` 集合类型,更多内容,请看 [Sets](../02_language_guide/CollectionTypes.md#sets) 。 +* Swift 现在自身提供了一个 `Set` 集合类型,更多内容,请看 [Sets](../02_language_guide/04_Collection_Types.md#sets) 。 * `@autoclosure` 现在是一个参数声明的属性,而不是参数类型的属性。这里还有一个新的参数声明属性 `@noescape`。更多内容,请看 [属性声明](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 。 * 对于类型属性和方法现在可以使用 `static` 关键字作为声明描述符,更多内容,请看 [类型变量属性](../03_language_reference/06_Declarations.md#type-variable-properties)。 * Swift 现在包含一个 `as?` 和 `as!` 的向下可失败类型转换运算符。更多内容,请看 [协议遵循性检查](../02_language_guide/21_Protocols.md#checking-for-protocol-conformance)。 -* 新增 [字符串索引](../02_language_guide/03_Strings_And_Characters.md#string-indices) 的新指导章节。 +* 新增 [字符串索引](../02_language_guide/03_Strings_and_Characters.md#string-indices) 的新指导章节。 * 在 [溢出运算符](../02_language_guide/27_Advanced_Operators.md#overflow-operators) 一节中删除了溢出除运算符(`&/`)和求余溢出运算符(`&%`)。 * 更新常量和常量属性在声明和构造时的规则,更多内容,请看 [常量声明](../03_language_reference/06_Declarations.md#constant-declaration) 。 -* 更新字符串字面量中 Unicode 标量集的定义,请看 [字符串字面量中的特殊字符](../02_language_guide/03_Strings_And_Characters.md#special-characters-in-string-literals) 。 -* 更新 [区间运算符](../02_language_guide/BasicOperators.md#range-operators) 章节,注意当半开区间运算符含有相同的起止索引时,其区间为空。 +* 更新字符串字面量中 Unicode 标量集的定义,请看 [字符串字面量中的特殊字符](../02_language_guide/03_Strings_and_Characters.md#special-characters-in-string-literals) 。 +* 更新 [区间运算符](../02_language_guide/02_Basic_Operators.md#range-operators) 章节,注意当半开区间运算符含有相同的起止索引时,其区间为空。 * 更新 [闭包引用类型](../02_language_guide/07_Closures.md#closures-are-reference-types) 章节,对于变量的捕获规则进行了阐明。 * 更新 [值溢出](../02_language_guide/27_Advanced_Operators.md#value-overflow) 章节,对有符号整数和无符号整数的溢出行为进行了阐明。 * 更新 [协议声明](../03_language_reference/06_Declarations.md#protocol-declaration) 章节,对协议声明时的作用域和成员等内容进行了阐明。 * 更新 [捕获列表](../02_language_guide/24_Automatic_Reference_Counting.md#defining-a-capture-list) 章节,对于闭包捕获列表中的弱引用和无主引用的使用语法进行了阐明。 * 更新 [运算符](../03_language_reference/02_Lexical_Structure.md#operator) 章节,明确指明一些例子来说明自定义运算符所支持的特性,如数学运算符,各种符号,Unicode 符号块等。 * 在函数作用域中的常量声明时可以不被初始化,它必须在第一次使用前被赋值。更多的内容,请看 [常量声明](../03_language_reference/06_Declarations.md#constant-declaration)。 -* 在构造器中,常量属性有且仅能被赋值一次。更多内容,请看 [在构造过程中给常量属性赋值](../02_language_guide/14_Initialization.md{#assigning-constant-properties-during-initialization)。 -* 多个可选绑定现在可以在`if`语句后面以逗号分隔的赋值列表的方式出现,更多内容,请看 [可选绑定](../02_language_guide/01_TheBasics.md#optional-binding)。 +* 在构造器中,常量属性有且仅能被赋值一次。更多内容,请看 [在构造过程中给常量属性赋值](../02_language_guide/14_Initialization.md#assigning-constant-properties-during-initialization)。 +* 多个可选绑定现在可以在`if`语句后面以逗号分隔的赋值列表的方式出现,更多内容,请看 [可选绑定](../02_language_guide/01_The_Basics.md#optional-binding)。 * 一个 [可选链表达式](../03_language_reference/04_Expressions.md#optional-chaining-expression) 必须出现在后缀表达式中。 * 协议类型转换不再局限于 `@obj` 修饰的协议了。 * 在运行时可能会失败的类型转换可以使用 `as?` 和 `as!` 运算符,而确保不会失败的类型转换现在使用 `as` 运算符。更多内容,请看 [类型转换运算符](../03_language_reference/04_Expressions.md#type-casting-operator)。 @@ -223,26 +223,26 @@ * 新增 [失败构造器](../02_language_guide/14_Initialization.md#failable-initializers) 的完整指引。 * 在协议中新增了 [失败构造器要求](../02_language_guide/21_Protocols.md#failable-initializer-requirements) 的描述。 * 常量和变量的 `Any` 类型现可以包含函数实例。更新了有关 `Any` 相关的示例来展示如何在 `switch` 语句中如何检查并转换到一个函数类型。 -* 带有原始值的枚举类型增加了一个 `rawValue` 属性替代 `toRaw()` 方法,同时使用了一个以 `rawValue` 为参数的失败构造器来替代 `fromRaw()` 方法。更多的内容,请看 [原始值](../02_language_guide/08_Enumerations.md#raw-values) 和 [带原始值的枚举类型](../03-language-reference/06-Declarations.md#enumerations-with-cases-of-a-raw-value-type)。 +* 带有原始值的枚举类型增加了一个 `rawValue` 属性替代 `toRaw()` 方法,同时使用了一个以 `rawValue` 为参数的失败构造器来替代 `fromRaw()` 方法。更多的内容,请看 [原始值](../02_language_guide/08_Enumerations.md#raw-values) 和 [带原始值的枚举类型](../03_language_reference/06_Declarations.md#enumerations-with-cases-of-a-raw-value-type)。 * 新增 [Failable Initializer](../03_language_reference/06_Declarations.md#failable-initializers) 的参考章节,它可以触发初始化失败。 -* 自定义运算符现在可以包含 `?` 字符,更新了 [运算符](../03_language_reference/02_Lexical_Structure.md#operator) 涉及改进后的规则的部分,并且在 [自定义运算符](../02-language-guide/27-Advanced-Operators.md#custom-operators) 章节中删除了重复的运算符有效字符集合。 +* 自定义运算符现在可以包含 `?` 字符,更新了 [运算符](../03_language_reference/02_Lexical_Structure.md#operator) 涉及改进后的规则的部分,并且在 [自定义运算符](../02_language_guide/27-Advanced-Operators.md#custom-operators) 章节中删除了重复的运算符有效字符集合。 ### 2014-08-18 * 描述 Swift 1.0 的新文档。Swift 是苹果公司发布的全新编程语言,用于 iOS 和 OS X 应用开发。 * 在协议中新增了 [对构造器的规定](../02_language_guide/21_Protocols.md#initializer-requirements) 章节。 * 新增 [类专属协议](../02_language_guide/21_Protocols.md#class-only-protocol) 章节。 -* [断言](../02_language_guide/01_TheBasics.md#assertions-and-preconditions) 现在可以使用字符串内插语法,并删除了文档中有冲突的注释。 -* 更新 [连接字符串和字符](../02_language_guide/03_Strings_And_Characters.md#concatenating-strings-and-characters) 章节来说明字符串和字符不能再用 `+` 号运算符或者复合加法运算符 `+=` 相互连接,这两种运算符现在只能用于字符串之间相连。请使用 `String` 类型的 `append` 方法在一个字符串的尾部增加单个字符。 -* 在 [属性申明](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 章节增加了有关 `availability` 特性的一些内容。 -* [可选类型](../02_language_guide/01_TheBasics.md#optionals) 若有值时,不再隐式的转换为 `true`,同样,若无值时,也不再隐式的转换为 `false`,这是为了避免在判别 optional `Bool` 的值时产生困惑。 替代的方案是,用`==` 或 `!=` 运算符显式地去判断 Optinal 是否是 `nil`,以确认其是否包含值。 -* Swift 新增了一个 [Nil 合并运算符](../02_language_guide/BasicOperators.md#nil-coalescing-operator) (`a ?? b`) , 该表达式中,如果 Optional `a` 的值存在,则取得它并返回,若 Optional `a` 为 `nil`,则返回默认值 `b` -* 更新和扩展 [字符串的比较](../02_language_guide/03_Strings_And_Characters.md#comparing-strings) ,用以反映和展示'字符串和字符的比较',以及'前缀(prefix)/后缀(postfix)比较'都开始基于扩展字符集(extended grapheme clusters)规范的等价比较。 -* 现在,你可以通过下标赋值或者 [可选调用链](../02_language_guide/16_Optional_Chaining.md) 中的可变方法和操作符来给属性设值。相应地更新了有关 [通过可选链接访问属性](../02_language_guide/16_Optional_Chaining.md#accessing-properties-through-optional-chaining) 的内容,并扩展了 [通过可选链接调用方法](../02-language-guide/16-Optional-Chaining.md#calling-methods-through-optional-chaining) 时检查方法调用成功的示例,以显示如何检查属性设置是否成功。 +* [断言](../02_language_guide/01_The_Basics.md#assertions-and-preconditions) 现在可以使用字符串内插语法,并删除了文档中有冲突的注释。 +* 更新 [连接字符串和字符](../02_language_guide/03_Strings_and_Characters.md#concatenating-strings-and-characters) 章节来说明字符串和字符不能再用 `+` 号运算符或者复合加法运算符 `+=` 相互连接,这两种运算符现在只能用于字符串之间相连。请使用 `String` 类型的 `append` 方法在一个字符串的尾部增加单个字符。 +* 在 [属性声明](../03_language_reference/07_Attributes.md#Ideclaration-attributes) 章节增加了有关 `availability` 特性的一些内容。 +* [可选类型](../02_language_guide/01_The_Basics.md#optionals) 若有值时,不再隐式的转换为 `true`,同样,若无值时,也不再隐式的转换为 `false`,这是为了避免在判别 optional `Bool` 的值时产生困惑。 替代的方案是,用`==` 或 `!=` 运算符显式地去判断 Optinal 是否是 `nil`,以确认其是否包含值。 +* Swift 新增了一个 [Nil 合并运算符](../02_language_guide/02_Basic_Operators.md#nil-coalescing-operator) (`a ?? b`) , 该表达式中,如果 Optional `a` 的值存在,则取得它并返回,若 Optional `a` 为 `nil`,则返回默认值 `b` +* 更新和扩展 [字符串的比较](../02_language_guide/03_Strings_and_Characters.md#comparing-strings) ,用以反映和展示'字符串和字符的比较',以及'前缀(prefix)/后缀(postfix)比较'都开始基于扩展字符集(extended grapheme clusters)规范的等价比较。 +* 现在,你可以通过下标赋值或者 [可选调用链](../02_language_guide/16_Optional_Chaining.md) 中的可变方法和操作符来给属性设值。相应地更新了有关 [通过可选链接访问属性](../02_language_guide/16_Optional_Chaining.md#accessing-properties-through-optional-chaining) 的内容,并扩展了 [通过可选链接调用方法](../02_language_guide/16_Optional_Chaining.md#calling-methods-through-optional-chaining) 时检查方法调用成功的示例,以显示如何检查属性设置是否成功。 * 在可选链中新增了 [访问可选类型的下标脚注](../02_language_guide/16_Optional_Chaining.md#accessing-subscripts-through-optional-chaining) 章节。 -* 更新 [访问和修改数组](../02_language_guide/CollectionTypes.md#accessing-and-modifying-a-dictionary) 章节以标示,从该版本起,不能再通过 `+=` 运算符给一个数组新增一个新的项。对应的替代方案是,使 `append` 方法,或者通过 `+=` 运算符来新增一个只有一个项的数组。 -* 新增一处说明,在 [范围运算符](../02_language_guide/BasicOperators.md#range-operators) 中,比如, `a..b` 和 `a..