更新部分内容到 Swift 5.7 (#1200)

* 更新内容到 Swift 5.7

* 更新内容到 Swift 5.7

* 更新内容到 Swift 5.7

* update to Swift version 5.7

* 更新内容到 Swift 5.7

* 更新内容到 Swift 5.7

* 修正部分术语

* 更新内容到 Swift 5.7

* 更新内容到 Swift 5.7

* 标题格式修改

* 修改了部分用词

* 修改了代码块格式

* 修改了代码段及行内代码格式

* 修改了代码段及行内代码样式

* 按照排版要求重新修改了部分格式

* Delete 02_Lexical_Structure.md

* Delete 03_Types.md

* Delete 04_Expressions.md

* Delete 05_Statements.md

* Delete 07_Attributes.md

* Delete 10_Summary_of_the_Grammar.md

* 根据排版指南修改了部分格式

* 根据排版指南修改了部分格式

* Update source/03_language_reference/02_Lexical_Structure.md

Co-authored-by: Jie Liang <lj925184928@gmail.com>
This commit is contained in:
Robortsystem
2022-09-10 21:00:58 +08:00
committed by GitHub
parent df35244821
commit 77b5caff91
20 changed files with 1092 additions and 723 deletions

View File

@ -132,6 +132,7 @@ struct Rect {
var square = Rect(origin: Point(x: 0.0, y: 0.0),
size: Size(width: 10.0, height: 10.0))
let initialSquareCenter = square.center
// initialSquareCenter 位于5.0 5.0
square.center = Point(x: 15.0, y: 15.0)
print("square.origin is now at (\(square.origin.x), \(square.origin.y))")
// 打印“square.origin is now at (10.0, 10.0)”
@ -302,7 +303,7 @@ struct TwelveOrLess {
}
```
这个 setter 确保新值小于 12而且返回被存储的值。
这个 setter 确保新值小于或等于 12而且返回被存储的值。
> 注意
>
> 上面例子以 `private` 的方式声明 `number` 变量,这使得 `number` 仅在 `TwelveOrLess` 的实现中使用。写在其他地方的代码通过使用 `wrappedValue` 的 getter 和 setter 来获取这个值,但不能直接使用 `number`。有关 `private` 的更多信息,请参考 [访问控制](./26_Access_Control.md)