From b7a8566a0fc5d8028923837d6cd9ae7b28d67057 Mon Sep 17 00:00:00 2001 From: Johnson <32932766+johnsongs@users.noreply.github.com> Date: Wed, 24 Jul 2019 12:31:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=20(#973)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update 09_Structures_And_Classes.md 驼峰 * Update 17_Error_Handling.md 病句 --- source/chapter2/09_Structures_And_Classes.md | 2 +- source/chapter2/17_Error_Handling.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/chapter2/09_Structures_And_Classes.md b/source/chapter2/09_Structures_And_Classes.md index e34733bc..7238ca4e 100755 --- a/source/chapter2/09_Structures_And_Classes.md +++ b/source/chapter2/09_Structures_And_Classes.md @@ -47,7 +47,7 @@ class SomeClass { > 注意 > -> 每当你定义一个新的结构体或者类时,你都是定义了一个新的 Swift 类型。请使用 `UpperCamelCase` 这种方式来命名类型(如这里的 `SomeClass` 和 `SomeStructure`),以便符合标准 Swift 类型的大写命名风格(如 `String`,`Int` 和 `Bool`)。请使用 `lowerCamelCase` 这种方式来命名属性和方法(如 `framerate` 和 `incrementCount`),以便和类型名区分。 +> 每当你定义一个新的结构体或者类时,你都是定义了一个新的 Swift 类型。请使用 `UpperCamelCase` 这种方式来命名类型(如这里的 `SomeClass` 和 `SomeStructure`),以便符合标准 Swift 类型的大写命名风格(如 `String`,`Int` 和 `Bool`)。请使用 `lowerCamelCase` 这种方式来命名属性和方法(如 `frameRate` 和 `incrementCount`),以便和类型名区分。 以下是定义结构体和定义类的示例: diff --git a/source/chapter2/17_Error_Handling.md b/source/chapter2/17_Error_Handling.md index 60f7d5b8..450c9b4c 100755 --- a/source/chapter2/17_Error_Handling.md +++ b/source/chapter2/17_Error_Handling.md @@ -114,7 +114,7 @@ func buyFavoriteSnack(person: String, vendingMachine: VendingMachine) throws { } ``` -上例中,`buyFavoriteSnack(person:vendingMachine:)` 函数会查找某人最喜欢的零食,并通过调用 `vend(itemNamed:)` 方法来尝试为他们购买。因为 `vend(itemNamed:)` 方法能抛出错误,所以在调用的它时候在它前面加了 `try` 关键字。 +上例中,`buyFavoriteSnack(person:vendingMachine:)` 函数会查找某人最喜欢的零食,并通过调用 `vend(itemNamed:)` 方法来尝试为他们购买。因为 `vend(itemNamed:)` 方法能抛出错误,所以在调用它的时候在它前面加了 `try` 关键字。 `throwing` 构造器能像 `throwing` 函数一样传递错误。例如下面代码中的 `PurchasedSnack` 构造器在构造过程中调用了 throwing 函数,并且通过传递到它的调用者来处理这些错误。