diff --git a/chapter1/01_swift.html b/chapter1/01_swift.html index 60e323af..f8366dda 100644 --- a/chapter1/01_swift.html +++ b/chapter1/01_swift.html @@ -46,7 +46,7 @@ -
Swift 是一种新的编程语言,用于编写 iOS 和 OS X 应用程序。Swift 结合了 C 和 Objective-C 的优点并且不受C的兼容性的限制。Swift 使用安全的编程模式并添加了很多新特性,这将使编程更简单,扩展性更强,也更有趣。除此之外,Swift 还支持人见人爱的 Cocoa 和 Cocoa Touch 框架。拥有了这些特性,Swift将重新定义软件开发。
diff --git a/chapter1/02_a_swift_tour.html b/chapter1/02_a_swift_tour.html index 30b1dc95..b3ddba46 100644 --- a/chapter1/02_a_swift_tour.html +++ b/chapter1/02_a_swift_tour.html @@ -46,7 +46,7 @@ -通常来说,编程语言教程中的第一个程序应该在屏幕上打印“Hello, world”。在 Swift 中,可以用一行代码实现:
@@ -783,7 +783,7 @@ hasAnyMatches(numbers, lessThanTen)练习:重写闭包,对所有奇数返回0.
有很多种创建闭包的方法。如果一个闭包的类型已知,比如作为一个回调函数,你可以忽略参数的类型和返回值。单个语句闭包会把它语句的值当做结果返回。
-你可以获取参数的数量——这个方法在非常短的闭包中很有用。一个被作为最后一个参数传入函数的时候可以直接出现在括号后面。
+你可以通过参数位置而不是参数名字来引用参数——这个方法在非常短的闭包中非常有用。当一个闭包作为最后一个参数传给一个函数的时候,它可以直接跟在括号后面。
sort([1, 5, 3, 12, 2]) { $0 > $1 }
使用class和类名来创建一个类。类中属性的声明和常量、变量声明一样,唯一的区别就是它们的上下文是类。同样,方法和函数声明也一样。
在本章中您将了解 Swift 的特性和开发历史,并对 Swift 有一个初步的了解。
diff --git a/chapter2/01_The_Basics.html b/chapter2/01_The_Basics.html index 13a04af7..3c59ce4c 100644 --- a/chapter2/01_The_Basics.html +++ b/chapter2/01_The_Basics.html @@ -46,7 +46,7 @@ -Swift 是 iOS 和 OS X 应用开发的一门新语言。然而,如果你有 C 或者 Objective-C 开发经验的话,你会发现 Swift 的很多内容都是你熟悉的。
diff --git a/chapter2/02_Basic_Operators.html b/chapter2/02_Basic_Operators.html index 456a93a6..7cede3b6 100644 --- a/chapter2/02_Basic_Operators.html +++ b/chapter2/02_Basic_Operators.html @@ -46,7 +46,7 @@ -String 是一个有序的字符集合,例如 "hello, world", "albatross"。 diff --git a/chapter2/04_Collection_Types.html b/chapter2/04_Collection_Types.html index ce775f97..bce0a0ae 100644 --- a/chapter2/04_Collection_Types.html +++ b/chapter2/04_Collection_Types.html @@ -46,7 +46,7 @@ -
函数是用来完成特定任务的独立的代码块。你给一个函数起一个合适的名字,用来标示函数做什么,并且当函数需要执行的时候,这个名字会被“调用”。
diff --git a/chapter2/07_Closures.html b/chapter2/07_Closures.html index bf987167..bf0dd998 100644 --- a/chapter2/07_Closures.html +++ b/chapter2/07_Closures.html @@ -46,7 +46,7 @@ -闭包是功能性自包含模块,可以在代码中被传递和使用。 diff --git a/chapter2/08_Enumerations.html b/chapter2/08_Enumerations.html index ad9609aa..e46500f5 100644 --- a/chapter2/08_Enumerations.html +++ b/chapter2/08_Enumerations.html @@ -46,7 +46,7 @@ -
Swift使用自动引用计数(ARC)这一机制来跟踪和管理你的应用程序的内存。通常情况下,Swift的内存管理机制会一直起着作用,你无须自己来考虑内存的管理。ARC会在类的实例不再被使用时,自动释放其占用的内存。
diff --git a/chapter2/17_Optional_Chaining.html b/chapter2/17_Optional_Chaining.html index b24b71f6..44b87a32 100644 --- a/chapter2/17_Optional_Chaining.html +++ b/chapter2/17_Optional_Chaining.html @@ -46,7 +46,7 @@ -枚举类型常被用于实现特定类或结构体的功能。也能够在有多种变量类型的环境中,方便地定义通用类或结构体来使用,为了实现这种功能,Swift允许你定义类型嵌套,可以在枚举类型、类和结构体中定义支持嵌套的类型。
diff --git a/chapter2/20_Extensions.html b/chapter2/20_Extensions.html index 0fd507b3..96cbae78 100644 --- a/chapter2/20_Extensions.html +++ b/chapter2/20_Extensions.html @@ -46,7 +46,7 @@ -本章介绍了 Swift 的各种特性及其使用方法,是全书的核心部分。
diff --git a/chapter3/01_About_the_Language_Reference.html b/chapter3/01_About_the_Language_Reference.html index 0528365b..a3781c24 100644 --- a/chapter3/01_About_the_Language_Reference.html +++ b/chapter3/01_About_the_Language_Reference.html @@ -46,7 +46,7 @@ -本书的这一节描述了Swift编程语言的形式语法。这里描述的语法是为了帮助您更详细的了解该语言,而不是让您直接实现一个解析器或编译器。
diff --git a/chapter3/02_Lexical_Structure.html b/chapter3/02_Lexical_Structure.html index 96b1d96e..fd45b056 100644 --- a/chapter3/02_Lexical_Structure.html +++ b/chapter3/02_Lexical_Structure.html @@ -46,7 +46,7 @@ -