diff --git a/chapter1/01_swift.html b/chapter1/01_swift.html index a6f7645c..043336b4 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 4e2e5936..165e3fee 100644 --- a/chapter1/02_a_swift_tour.html +++ b/chapter1/02_a_swift_tour.html @@ -46,7 +46,7 @@ -本页内容包括:
diff --git a/chapter1/chapter1.html b/chapter1/chapter1.html index 7f62a34d..c2e1d95b 100644 --- a/chapter1/chapter1.html +++ b/chapter1/chapter1.html @@ -46,7 +46,7 @@ -在本章中您将了解 Swift 的特性和开发历史,并对 Swift 有一个初步的了解。
diff --git a/chapter2/01_The_Basics.html b/chapter2/01_The_Basics.html index 50fd12d1..d2dfd863 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 的很多内容都是你熟悉的。
@@ -849,7 +849,7 @@ println("The status message is \(http200Status.description)")-注意:C 和 Objective-C 中并没有可选这个概念。最接近的是 Objective-C 中的一个特性,一个方法要不返回一个对象要不返回
+nil,nil表示“缺少一个合法的对象”。然而,这只对对象起作用——对于结构体,基本的 C 类型或者美剧类型不起作用。对于这些类型,Objective-C 方法一般会返回一个特殊值(比如NSNotFound)来暗示值缺失。这种方法假设方法的调用者知道并记得对特殊值进行判断。然而,Swift 的可选可以让你暗示任意类型的值缺失,并不需要一个特殊值。注意:C 和 Objective-C 中并没有可选这个概念。最接近的是 Objective-C 中的一个特性,一个方法要不返回一个对象要不返回
nil,nil表示“缺少一个合法的对象”。然而,这只对对象起作用——对于结构体,基本的 C 类型或者枚举类型不起作用。对于这些类型,Objective-C 方法一般会返回一个特殊值(比如NSNotFound)来暗示值缺失。这种方法假设方法的调用者知道并记得对特殊值进行判断。然而,Swift 的可选可以让你暗示任意类型的值缺失,并不需要一个特殊值。
来看一个例子。Swift 的String类型有一个叫做toInt的方法,作用是将一个String值转换成一个Int值。然而,并不是所有的字符串都可以转换成一个整数。字符串"123"可以被转换成数字123,但是字符串"hello, world"不行。
下面的例子使用toInt方法来尝试将一个String转换成Int:
运算符是检查, 改变, 合并值的特殊符号或短语. 例如, 加号 + 把计算两个数的和(如 let i = 1 + 2). 复杂些的运行算包括逻辑与&&(如 if enteredDoorCode && passedRetinaScan), 还有自增运算符 ++i 这样让自身加一的便捷运算.
本页包含内容:
diff --git a/chapter2/04_Collection_Types.html b/chapter2/04_Collection_Types.html index 3ada979b..da2f6ee5 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 f8190ea3..9040c03b 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 12c70989..fcb56711 100644 --- a/chapter2/08_Enumerations.html +++ b/chapter2/08_Enumerations.html @@ -46,7 +46,7 @@ -本页包含内容:
diff --git a/chapter2/10_Properties.html b/chapter2/10_Properties.html index c4c61eee..fb07feb4 100644 --- a/chapter2/10_Properties.html +++ b/chapter2/10_Properties.html @@ -46,7 +46,7 @@ -本页包含内容:
diff --git a/chapter2/17_Optional_Chaining.html b/chapter2/17_Optional_Chaining.html index c390aba1..114648f6 100644 --- a/chapter2/17_Optional_Chaining.html +++ b/chapter2/17_Optional_Chaining.html @@ -46,7 +46,7 @@ -(ps:为了方便各位检验所以保留了英文,可删。) diff --git a/chapter2/19_Nested_Types.html b/chapter2/19_Nested_Types.html index 222a6dcf..c86d633d 100644 --- a/chapter2/19_Nested_Types.html +++ b/chapter2/19_Nested_Types.html @@ -46,7 +46,7 @@ -
本页包含内容:
diff --git a/chapter2/20_Extensions.html b/chapter2/20_Extensions.html index f5b413cc..373219fd 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 77e309a1..cc74a6eb 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 5efc39d5..2a100037 100644 --- a/chapter3/02_Lexical_Structure.html +++ b/chapter3/02_Lexical_Structure.html @@ -46,7 +46,7 @@ -Swift 是苹果在 WWDC 2014 上发布的一款全新的编程语言,本书译自苹果官方的 Swift 教程《The Swift Programming Language》。
diff --git a/manifest.appcache b/manifest.appcache index dbe74e42..e3043a23 100644 --- a/manifest.appcache +++ b/manifest.appcache @@ -1,11 +1,11 @@ CACHE MANIFEST -# Revision 1402183329826 +# Revision 1402183488922 CACHE: index.html chapter1/01_swift.html -chapter1/02_a_swift_tour.html chapter1/chapter1.html +chapter1/02_a_swift_tour.html chapter2/13_Inheritance.html chapter2/01_The_Basics.html chapter2/03_Strings_and_Characters.html diff --git a/search_index.json b/search_index.json index 654eafe9..4e4719fc 100644 --- a/search_index.json +++ b/search_index.json @@ -1 +1 @@ -{"version":"0.5.2","fields":[{"name":"title","boost":10},{"name":"body","boost":1}],"ref":"url","documentStore":{"store":{"index.html#gitbook_4":["2014","languag","program","swift","undefinedundefin","wwdc"],"chapter1/01_swift.html#gitbook_5":["arc","automat","c","cocoa","cocoa的基础上构建框架栈并将其标准化。objective-c","count","c的兼容性的限制。swift","foundat","hello","io","objective-c","os","refer","swift","touch","undefinedundefin","world","x"],"chapter1/02_a_swift_tour.html#gitbook_6":["0","0..3","0..time","0.0","1","10","100","103","11","12","13","16","19","2","2.5","20","25","3","3.0","3.1","3.59","3.69","3.79","4","42","43","5","5.2","50","597","69105","7","7.simpledescript","70","70.0","75","8","87","8:09","9","9.9","94","a.adjust","a.simpledescript","ac","ace.toraw","acerawvalu","add","addon","addone(numb","adescript","adjust","amount","anoth","anotherproperti","ant","anycommonel","anycommonelements([1","appl","applese","applesummari","area","b","b.adjust","b.simpledescript","bdescript","blue","bool","bottl","c","captain","card","card(rank","card添加一个方法,创建一副完整的扑克牌并把每张牌的rank和suit","case","catfish","celeri","chees","class","club","condit","condition(item","convertedrank","convertedrank.simpledescript","count","counter","counter.incrementby(2","cucumb","dai","default","deinit","diamond","dictionary