make gitbook
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.1" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.1" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,10 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_591">
|
||||
<section class="normal" id="section-gitbook_11">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:numbbbbb, lyuka, JaySurplus<br>校对:lslxdx </p>
|
||||
<p>翻译:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a>, <a href="https://github.com/lyuka" target="_blank">lyuka</a>, <a href="https://github.com/JaySurplus" target="_blank">JaySurplus</a><br>校对:<a href="https://github.com/lslxdx" target="_blank">lslxdx</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-">基础部分</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.2" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.2" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,10 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_612">
|
||||
<section class="normal" id="section-gitbook_32">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:xielingwang<br>校对:Evilcome </p>
|
||||
<p>翻译:<a href="https://github.com/xielingwang" target="_blank">xielingwang</a><br>校对:<a href="https://github.com/Evilcome" target="_blank">Evilcome</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-">基本运算符</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.3" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.3" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_593">
|
||||
<section class="normal" id="section-gitbook_13">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:wh1100717<br>校对:Hawstein </p>
|
||||
<p>翻译:<a href="https://github.com/wh1100717" target="_blank">wh1100717</a>
|
||||
校对:<a href="https://github.com/Hawstein" target="_blank">Hawstein</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-strings-and-characters-">字符串和字符(Strings and Characters)</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.4" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.4" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,11 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_595">
|
||||
<section class="normal" id="section-gitbook_15">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:zqp
|
||||
校对:shinyzhu</p>
|
||||
<p>翻译:<a href="https://github.com/zqp" target="_blank">zqp</a>
|
||||
校对:<a href="https://github.com/shinyzhu" target="_blank">shinyzhu</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a> </p>
|
||||
</blockquote>
|
||||
<h1 id="-collection-types-">集合类型 (Collection Types)</h1>
|
||||
<hr>
|
||||
@ -604,8 +604,7 @@
|
||||
<p>Swift 语言提供经典的数组和字典两种集合类型来存储集合数据。数组用来按顺序存储相同类型的数据。字典虽然无序存储相同类型数据值但是需要由独有的标识符引用和寻址(就是键值对)。</p>
|
||||
<p>Swift 语言里的数组和字典中存储的数据值类型必须明确。 这意味着我们不能把不正确的数据类型插入其中。 同时这也说明我们完全可以对获取出的值类型非常自信。 Swift 对显式类型集合的使用确保了我们的代码对工作所需要的类型非常清楚,也让我们在开发中可以早早地找到任何的类型不匹配错误。</p>
|
||||
<blockquote>
|
||||
<p>注意:
|
||||
Swift 的数组结构在被声明成常量和变量或者被传入函数与方法中时会相对于其他类型展现出不同的特性。 获取更多信息请参见<a href="#mutability_of_collections">集合的可变性</a>与<a href="09_Classes_and_Structures.html#assignment_and_copy_behavior_for_collection_types">集合在赋值和复制中的行为</a>章节。</p>
|
||||
<p>注意:<br>Swift 的数组结构在被声明成常量和变量或者被传入函数与方法中时会相对于其他类型展现出不同的特性。 获取更多信息请参见<a href="#mutability_of_collections">集合的可变性</a>与<a href="09_Classes_and_Structures.html#assignment_and_copy_behavior_for_collection_types">集合在赋值和复制中的行为</a>章节。</p>
|
||||
</blockquote>
|
||||
<p><a name="arrays"></a></p>
|
||||
<h2 id="-">数组</h2>
|
||||
@ -624,8 +623,7 @@ Swift 的数组结构在被声明成常量和变量或者被传入函数与方
|
||||
</code></pre>
|
||||
<p><code>shoppingList</code>变量被声明为“字符串值类型的数组“,记作<code>String[]</code>。 因为这个数组被规定只有<code>String</code>一种数据结构,所以只有<code>String</code>类型可以在其中被存取。 在这里,<code>shoppinglist</code>数组由两个<code>String</code>值(<code>"Eggs"</code> 和<code>"Milk"</code>)构造,并且由字面量定义。</p>
|
||||
<blockquote>
|
||||
<p>注意:
|
||||
<code>Shoppinglist</code>数组被声明为变量(<code>var</code>关键字创建)而不是常量(<code>let</code>创建)是因为以后可能会有更多的数据项被插入其中。</p>
|
||||
<p>注意:<br><code>Shoppinglist</code>数组被声明为变量(<code>var</code>关键字创建)而不是常量(<code>let</code>创建)是因为以后可能会有更多的数据项被插入其中。 </p>
|
||||
</blockquote>
|
||||
<p>在这个例子中,字面量仅仅包含两个<code>String</code>值。匹配了该数组的变量声明(只能包含<code>String</code>的数组),所以这个字面量的分配过程就是允许用两个初始项来构造<code>shoppinglist</code>。</p>
|
||||
<p>由于 Swift 的类型推断机制,当我们用字面量构造只拥有相同类型值数组的时候,我们不必把数组的类型定义清楚。 <code>shoppinglist</code>的构造也可以这样写:</p>
|
||||
@ -672,25 +670,8 @@ Swift 的数组结构在被声明成常量和变量或者被传入函数与方
|
||||
<pre><code class="lang-swift">shoppingList[4...6] = ["Bananas", "Apples"]
|
||||
// shoppingList 现在有六项
|
||||
</code></pre>
|
||||
<p><<<<<<< HEAD</p>
|
||||
<blockquote>
|
||||
<p>注意:</p>
|
||||
<h1 id="-count-count-0-count-1-">我们不能使用下标语法在数组尾部添加新项。如果我们试着用这种方法对索引越界的数据进行检索或者设置新值的操作,我们会引发一个运行期错误。我们可以使用索引值和数组的<code>count</code>属性进行比较来在使用某个索引之前先检验是否有效。除了当<code>count</code>等于 0 时(说明这是个空数组),最大索引值一直是<code>count - 1</code>,因为数组都是零起索引。</h1>
|
||||
<p>注意:</p>
|
||||
<p>我们不能使用下标语法在数组尾部添加新项。如果我们试着用这种方法对索引越界的数据进行检索或者设置新值的操作,我们会引发一个运行时错误。我们可以使用索引值和数组的<code>count</code>属性进行比较来在使用某个索引之前先检验是否有效。除了当<code>count</code>等于 0 时(说明这是个空数组),最大索引值一直是<code>count - 1</code>,因为数组都是零起索引。</p>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<p>a516af6a531a104ec88da0d236ecf389a5ec72af</p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<p>注意:<br>我们不能使用下标语法在数组尾部添加新项。如果我们试着用这种方法对索引越界的数据进行检索或者设置新值的操作,我们会引发一个运行期错误。我们可以使用索引值和数组的<code>count</code>属性进行比较来在使用某个索引之前先检验是否有效。除了当<code>count</code>等于 0 时(说明这是个空数组),最大索引值一直是<code>count - 1</code>,因为数组都是零起索引。 </p>
|
||||
</blockquote>
|
||||
<p>调用数组的<code>insert(atIndex:)</code>方法来在某个具体索引值之前添加数据项:</p>
|
||||
<pre><code class="lang-swift">shoppingList.insert("Maple Syrup", atIndex: 0)
|
||||
@ -780,8 +761,7 @@ someInts = []
|
||||
</code></pre>
|
||||
<p><code>airports</code>字典被定义为一种<code>Dictionary<String, String></code>,它意味着这个字典的键和值都是<code>String</code>类型。</p>
|
||||
<blockquote>
|
||||
<p>注意:
|
||||
<code>airports</code>字典被声明为变量(用<code>var</code>关键字)而不是常量(<code>let</code>关键字)因为后来更多的机场信息会被添加到这个示例字典中。</p>
|
||||
<p>注意:<br><code>airports</code>字典被声明为变量(用<code>var</code>关键字)而不是常量(<code>let</code>关键字)因为后来更多的机场信息会被添加到这个示例字典中。 </p>
|
||||
</blockquote>
|
||||
<p><code>airports</code>字典使用字典字面量初始化,包含两个键值对。第一对的键是<code>TYO</code>,值是<code>Tokyo</code>。第二对的键是<code>DUB</code>,值是<code>Dublin</code>。</p>
|
||||
<p>这个字典语句包含了两个<code>String: String</code>类型的键值对。它们对应<code>airports</code>变量声明的类型(一个只有<code>String</code>键和<code>String</code>值的字典)所以这个字典字面量是构造两个初始数据项的<code>airport</code>字典。</p>
|
||||
@ -848,8 +828,8 @@ airports["APL"] = nil
|
||||
}
|
||||
// Airport code: TYO
|
||||
// Airport code: LHR
|
||||
</code></pre>
|
||||
<pre><code class="lang-swift">for airportName in airports.values {
|
||||
|
||||
for airportName in airports.values {
|
||||
println("Airport name: \(airportName)")
|
||||
}
|
||||
// Airport name: Tokyo
|
||||
@ -858,13 +838,12 @@ airports["APL"] = nil
|
||||
<p>如果我们只是需要使用某个字典的键集合或者值集合来作为某个接受<code>Array</code>实例 API 的参数,可以直接使用<code>keys</code>或者<code>values</code>属性直接构造一个新数组:</p>
|
||||
<pre><code class="lang-swift">let airportCodes = Array(airports.keys)
|
||||
// airportCodes is ["TYO", "LHR"]
|
||||
</code></pre>
|
||||
<pre><code class="lang-swift">let airportNames = Array(airports.values)
|
||||
|
||||
let airportNames = Array(airports.values)
|
||||
// airportNames is ["Tokyo", "London Heathrow"]
|
||||
</code></pre>
|
||||
<blockquote>
|
||||
<p>注意:
|
||||
Swift 的字典类型是无序集合类型。其中字典键,值,键值对在遍历的时候会重新排列,而且其中顺序是不固定的。</p>
|
||||
<p>注意:<br>Swift 的字典类型是无序集合类型。其中字典键,值,键值对在遍历的时候会重新排列,而且其中顺序是不固定的。 </p>
|
||||
</blockquote>
|
||||
<p><a name="creating_an_empty_dictionary"></a></p>
|
||||
<h3 id="-">创建一个空字典</h3>
|
||||
@ -880,8 +859,7 @@ namesOfIntegers = [:]
|
||||
// namesOfIntegers 又成为了一个 Int, String类型的空字典
|
||||
</code></pre>
|
||||
<blockquote>
|
||||
<p>注意:
|
||||
在后台,Swift 的数组和字典都是由泛型集合来实现的,想了解更多泛型和集合信息请参见<a href="22_Generics.html">泛型</a>。</p>
|
||||
<p>注意:<br>在后台,Swift 的数组和字典都是由泛型集合来实现的,想了解更多泛型和集合信息请参见<a href="22_Generics.html">泛型</a>。 </p>
|
||||
</blockquote>
|
||||
<p><a name="mutability_of_collections"></a></p>
|
||||
<h2 id="-">集合的可变性</h2>
|
||||
@ -890,8 +868,7 @@ namesOfIntegers = [:]
|
||||
不可变性对数组来说有一点不同,当然我们不能试着改变任何不可变数组的大小,但是我们可以重新设定相对现存索引所对应的值。这使得 Swift 数组在大小被固定的时候依然可以做的很棒。</p>
|
||||
<p>Swift 数组的可变性行为同时影响了数组实例如何被分配和修改,想获取更多信息,请参见<a href="09_Classes_and_Structures.html#assignment_and_copy_behavior_for_collection_types">集合在赋值和复制中的行为</a>。</p>
|
||||
<blockquote>
|
||||
<p>注意:
|
||||
在我们不需要改变数组大小的时候创建不可变数组是很好的习惯。如此 Swift 编译器可以优化我们创建的集合。</p>
|
||||
<p>注意:<br>在我们不需要改变数组大小的时候创建不可变数组是很好的习惯。如此 Swift 编译器可以优化我们创建的集合。 </p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.5" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.5" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_597">
|
||||
<section class="normal" id="section-gitbook_17">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:vclwei, coverxit, NicePiao<br>校对:coverxit, stanzhai</p>
|
||||
<p>翻译:<a href="https://github.com/vclwei" target="_blank">vclwei</a>, <a href="https://github.com/coverxit" target="_blank">coverxit</a>, <a href="https://github.com/NicePiao" target="_blank">NicePiao</a>
|
||||
校对:<a href="https://github.com/coverxit" target="_blank">coverxit</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-">控制流</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.6" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.6" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_599">
|
||||
<section class="normal" id="section-gitbook_19">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:honghaoz<br>校对:LunaticM </p>
|
||||
<p>翻译:<a href="https://github.com/honghaoz" target="_blank">honghaoz</a>
|
||||
校对:<a href="https://github.com/LunaticM" target="_blank">LunaticM</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-functions-">函数(Functions)</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.7" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.7" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_601">
|
||||
<section class="normal" id="section-gitbook_21">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:wh1100717<br>校对:lyuka </p>
|
||||
<p>翻译:<a href="https://github.com/wh1100717" target="_blank">wh1100717</a>
|
||||
校对:<a href="https://github.com/lyuka" target="_blank">lyuka</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-closures-">闭包(Closures)</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.8" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.8" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_603">
|
||||
<section class="normal" id="section-gitbook_23">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:yankuangshi<br>校对:shinyzhu </p>
|
||||
<p>翻译:<a href="https://github.com/yankuangshi" target="_blank">yankuangshi</a>
|
||||
校对:<a href="https://github.com/shinyzhu" target="_blank">shinyzhu</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-enumerations-">枚举(Enumerations)</h1>
|
||||
<hr>
|
||||
@ -609,7 +610,7 @@
|
||||
<p><a name="enumeration_syntax"></a></p>
|
||||
<h2 id="-">枚举语法</h2>
|
||||
<p>使用<code>enum</code>关键词并且把它们的整个定义放在一对大括号内:</p>
|
||||
<pre><code class="lang-swift">enum SomeEumeration {
|
||||
<pre><code class="lang-swift">enum SomeEnumeration {
|
||||
// enumeration definition goes here
|
||||
}
|
||||
</code></pre>
|
||||
@ -721,7 +722,7 @@ case let .QRCode(productCode):
|
||||
case CarriageReturn = "\r"
|
||||
}
|
||||
</code></pre>
|
||||
<p>在这里,称为<code>ASCIIControlCharacter</code>的枚举的原始值类型被定义为字符型<code>Character</code>,并被设置了一些比较常见的 ASCII 控制字符。字符值的描述请详见字符串和字符<code>Strings and Characters</code>部分。</p>
|
||||
<p>在这里,称为<code>ASCIIControlCharacter</code>的枚举的原始值类型被定义为字符型<code>Character</code>,并被设置了一些比较常见的 ASCII 控制字符。字符值的描述请详见字符串和字符<a href="03_Strings_and_Characters.html"><code>Strings and Characters</code></a>部分。</p>
|
||||
<p>注意,原始值和实例值是不相同的。当你开始在你的代码中定义枚举的时候原始值是被预先填充的值,像上述三个 ASCII 码。对于一个特定的枚举成员,它的原始值始终是相同的。实例值是当你在创建一个基于枚举成员的新常量或变量时才会被设置,并且每次当你这么做得时候,它的值可以是不同的。</p>
|
||||
<p>原始值可以是字符串,字符,或者任何整型值或浮点型值。每个原始值在它的枚举声明中必须是唯一的。当整型值被用于原始值,如果其他枚举成员没有值时,它们会自动递增。</p>
|
||||
<p>下面的枚举是对之前<code>Planet</code>这个枚举的一个细化,利用原始整型值来表示每个 planet 在太阳系中的顺序:</p>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.9" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.9" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_605">
|
||||
<section class="normal" id="section-gitbook_25">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:JaySurplus<br>校对:sg552 </p>
|
||||
<p>翻译:<a href="https://github.com/JaySurplus" target="_blank">JaySurplus</a>
|
||||
校对:<a href="https://github.com/sg552" target="_blank">sg552</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-">类和结构体</h1>
|
||||
<p>本页包含内容:</p>
|
||||
@ -609,36 +610,13 @@
|
||||
<p><a name="comparing_classes_and_structures"></a></p>
|
||||
<h3 id="-">类和结构体对比</h3>
|
||||
<p>Swift 中类和结构体有很多共同点。共同处在于:</p>
|
||||
<p><<<<<<< HEAD</p>
|
||||
<ul>
|
||||
<li>定义属性用于储存值</li>
|
||||
<li>定义方法用于提供功能</li>
|
||||
<li>定义附属脚本用于访问值</li>
|
||||
<li>定义构造器用于生成初始化值</li>
|
||||
<li>通过扩展以增加默认实现的功能</li>
|
||||
<li><h1 id="-">符合协议以对某类提供标准功能</h1>
|
||||
</li>
|
||||
<li>定义属性用于储存值</li>
|
||||
<li>定义方法用于提供功能</li>
|
||||
<li>定义下标脚本用于访问值</li>
|
||||
<li>定义构造器用于生成初始化值</li>
|
||||
<li>通过扩展以增加默认实现的功能</li>
|
||||
<li>符合协议以对某类提供标准功能<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<p>a516af6a531a104ec88da0d236ecf389a5ec72af</p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</li>
|
||||
<li>符合协议以对某类提供标准功能</li>
|
||||
</ul>
|
||||
<p>更多信息请参见 <a href="10_Properties.html">属性</a>,<a href="11_Methods.html">方法</a>,<a href="12_Subscripts.html">下标脚本</a>,<a href="14_Initialization.html">初始过程</a>,<a href="20_Extensions.html">扩展</a>,和<a href="21_Protocols.html">协议</a>。</p>
|
||||
<p>与结构体相比,类还有如下的附加功能:</p>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.10" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.10" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_606">
|
||||
<section class="normal" id="section-gitbook_26">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:shinyzhu<br>校对:pp-prog </p>
|
||||
<p>翻译:<a href="https://github.com/shinyzhu" target="_blank">shinyzhu</a>
|
||||
校对:<a href="https://github.com/pp-prog" target="_blank">pp-prog</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-properties-">属性 (Properties)</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.11" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.11" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_608">
|
||||
<section class="normal" id="section-gitbook_28">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:pp-prog<br>校对:zqp </p>
|
||||
<p>翻译:<a href="https://github.com/pp-prog" target="_blank">pp-prog</a>
|
||||
校对:<a href="https://github.com/zqp" target="_blank">zqp</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-methods-">方法(Methods)</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.12" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.12" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_610">
|
||||
<section class="normal" id="section-gitbook_30">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:siemenliu<br>校对:zq54zquan </p>
|
||||
<p>翻译:<a href="https://github.com/siemenliu" target="_blank">siemenliu</a>
|
||||
校对:<a href="https://github.com/zq54zquan" target="_blank">zq54zquan</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-subscripts-">下标脚本(Subscripts)</h1>
|
||||
<hr>
|
||||
@ -602,23 +603,8 @@
|
||||
</ul>
|
||||
<p><em>下标脚本</em> 可以定义在类(Class)、结构体(structure)和枚举(enumeration)这些目标中,可以认为是访问对象、集合或序列的快捷方式,不需要再调用实例的特定的赋值和访问方法。举例来说,用下标脚本访问一个数组(Array)实例中的元素可以这样写 <code>someArray[index]</code> ,访问字典(Dictionary)实例中的元素可以这样写 <code>someDictionary[key]</code>。</p>
|
||||
<p>对于同一个目标可以定义多个下标脚本,通过索引值类型的不同来进行重载,而且索引值的个数可以是多个。</p>
|
||||
<p><<<<<<< HEAD</p>
|
||||
<h1 id="-">> 译者:这里附属脚本重载在本小节中原文并没有任何演示 </h1>
|
||||
<blockquote>
|
||||
<p>译者:这里下标脚本重载在本小节中原文并没有任何演示</p>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<p>a516af6a531a104ec88da0d236ecf389a5ec72af</p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<p>译者:这里附属脚本重载在本小节中原文并没有任何演示 </p>
|
||||
</blockquote>
|
||||
<p><a name="subscript_syntax"></a></p>
|
||||
<h2 id="-">下标脚本语法</h2>
|
||||
@ -652,25 +638,8 @@ println("3的6倍是\(threeTimesTable[6])")
|
||||
</code></pre>
|
||||
<p>在上例中,通过<code>TimesTable</code>结构体创建了一个用来表示索引值三倍的实例。数值<code>3</code>作为结构体<code>构造函数</code>入参初始化实例成员<code>multiplier</code>。</p>
|
||||
<p>你可以通过下标脚本来得到结果,比如<code>threeTimesTable[6]</code>。这条语句访问了<code>threeTimesTable</code>的第六个元素,返回<code>6</code>的<code>3</code>倍即<code>18</code>。</p>
|
||||
<p><<<<<<< HEAD</p>
|
||||
<blockquote>
|
||||
<p>注意: </p>
|
||||
<h1 id="-timestable-threetimestable-someindex-"><code>TimesTable</code>例子是基于一个固定的数学公式。它并不适合开放写权限来对<code>threeTimesTable[someIndex]</code>进行赋值操作,这也是为什么附属脚本只定义为只读的原因。 </h1>
|
||||
<p>注意:</p>
|
||||
<p><code>TimesTable</code>例子是基于一个固定的数学公式。它并不适合开放写权限来对<code>threeTimesTable[someIndex]</code>进行赋值操作,这也是为什么下标脚本只定义为只读的原因。</p>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<p>a516af6a531a104ec88da0d236ecf389a5ec72af</p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<p>注意:<br><code>TimesTable</code>例子是基于一个固定的数学公式。它并不适合开放写权限来对<code>threeTimesTable[someIndex]</code>进行赋值操作,这也是为什么附属脚本只定义为只读的原因。 </p>
|
||||
</blockquote>
|
||||
<p><a name="subscript_usage"></a></p>
|
||||
<h2 id="-">下标脚本用法</h2>
|
||||
@ -681,25 +650,8 @@ numberOfLegs["bird"] = 2
|
||||
</code></pre>
|
||||
<p>上例定义一个名为<code>numberOfLegs</code>的变量并用一个字典字面量初始化出了包含三对键值的字典实例。<code>numberOfLegs</code>的字典存放值类型推断为<code>Dictionary<String, Int></code>。字典实例创建完成之后通过下标脚本的方式将整型值<code>2</code>赋值到字典实例的索引为<code>bird</code>的位置中。</p>
|
||||
<p>更多关于字典(Dictionary)下标脚本的信息请参考<a href="../chapter2/04_Collection_Types.html">读取和修改字典</a></p>
|
||||
<p><<<<<<< HEAD</p>
|
||||
<blockquote>
|
||||
<p>注意: </p>
|
||||
<h1 id="swift-get-int-numberoflegs-int-int-nil-nil-">Swift 中字典的附属脚本实现中,在<code>get</code>部分返回值是<code>Int?</code>,上例中的<code>numberOfLegs</code>字典通过附属脚本返回的是一个<code>Int?</code>或者说“可选的int”,不是每个字典的索引都能得到一个整型值,对于没有设过值的索引的访问返回的结果就是<code>nil</code>;同样想要从字典实例中删除某个索引下的值也只需要给这个索引赋值为<code>nil</code>即可。 </h1>
|
||||
<p>注意:</p>
|
||||
<p>Swift 中字典的下标脚本实现中,在<code>get</code>部分返回值是<code>Int?</code>,上例中的<code>numberOfLegs</code>字典通过下标脚本返回的是一个<code>Int?</code>或者说“可选的int”,不是每个字典的索引都能得到一个整型值,对于没有设过值的索引的访问返回的结果就是<code>nil</code>;同样想要从字典实例中删除某个索引下的值也只需要给这个索引赋值为<code>nil</code>即可。</p>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<blockquote>
|
||||
<p>a516af6a531a104ec88da0d236ecf389a5ec72af</p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<p>注意:<br>Swift 中字典的附属脚本实现中,在<code>get</code>部分返回值是<code>Int?</code>,上例中的<code>numberOfLegs</code>字典通过附属脚本返回的是一个<code>Int?</code>或者说“可选的int”,不是每个字典的索引都能得到一个整型值,对于没有设过值的索引的访问返回的结果就是<code>nil</code>;同样想要从字典实例中删除某个索引下的值也只需要给这个索引赋值为<code>nil</code>即可。 </p>
|
||||
</blockquote>
|
||||
<p><a name="subscript_options"></a></p>
|
||||
<h2 id="-">下标脚本选项</h2>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.13" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.13" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_589">
|
||||
<section class="normal" id="section-gitbook_9">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:Hawstein<br>校对:menlongsheng </p>
|
||||
<p>翻译:<a href="https://github.com/Hawstein" target="_blank">Hawstein</a>
|
||||
校对:<a href="https://github.com/menlongsheng" target="_blank">menlongsheng</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-inheritance-">继承(Inheritance)</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.14" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.14" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_614">
|
||||
<section class="normal" id="section-gitbook_34">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:lifedim<br>校对:lifedim </p>
|
||||
<p>翻译:<a href="https://github.com/lifedim" target="_blank">lifedim</a>
|
||||
校对:<a href="https://github.com/lifedim" target="_blank">lifedim</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-initialization-">构造过程(Initialization)</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.15" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.15" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_616">
|
||||
<section class="normal" id="section-gitbook_36">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:bruce0505<br>校对:fd5788 </p>
|
||||
<p>翻译:<a href="https://github.com/bruce0505" target="_blank">bruce0505</a>
|
||||
校对:<a href="https://github.com/fd5788" target="_blank">fd5788</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-deinitialization-">析构过程(Deinitialization)</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.16" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.16" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_618">
|
||||
<section class="normal" id="section-gitbook_38">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:TimothyYe<br>校对:Hawstein </p>
|
||||
<p>翻译:<a href="https://github.com/TimothyYe" target="_blank">TimothyYe</a>
|
||||
校对:<a href="https://github.com/Hawstein" target="_blank">Hawstein</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-">自动引用计数</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.17" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.17" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_620">
|
||||
<section class="normal" id="section-gitbook_40">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:Jasonbroker<br>校对:numbbbbb, stanzhai </p>
|
||||
<p>翻译:<a href="https://github.com/Jasonbroker" target="_blank">Jasonbroker</a>
|
||||
校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
</blockquote>
|
||||
<h1 id="optional-chaining">Optional Chaining</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.18" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.18" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_622">
|
||||
<section class="normal" id="section-gitbook_42">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:xiehurricane<br>校对:happyming </p>
|
||||
<p>翻译:<a href="https://github.com/xiehurricane" target="_blank">xiehurricane</a>
|
||||
校对:<a href="https://github.com/happyming" target="_blank">happyming</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-type-casting-">类型检查(Type Casting)</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.19" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.19" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_624">
|
||||
<section class="normal" id="section-gitbook_44">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:Lin-H<br>校对:shinyzhu </p>
|
||||
<p>翻译:<a href="https://github.com/Lin-H" target="_blank">Lin-H</a>
|
||||
校对:<a href="https://github.com/shinyzhu" target="_blank">shinyzhu</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-">类型嵌套</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.20" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.20" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_626">
|
||||
<section class="normal" id="section-gitbook_46">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:lyuka<br>校对:Hawstein </p>
|
||||
<p>翻译:<a href="https://github.com/lyuka" target="_blank">lyuka</a>
|
||||
校对:<a href="https://github.com/Hawstein" target="_blank">Hawstein</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-extensions-">扩展(Extensions)</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.21" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.21" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,11 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_633">
|
||||
<section class="normal" id="section-gitbook_48">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:geek5nan
|
||||
校对:dabing1022</p>
|
||||
<p>翻译:<a href="https://github.com/geek5nan" target="_blank">geek5nan</a>
|
||||
校对:<a href="https://github.com/dabing1022" target="_blank">dabing1022</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-">协议</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.22" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.22" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_628">
|
||||
<section class="normal" id="section-gitbook_50">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:takalard<br>校对:lifedim </p>
|
||||
<p>翻译:<a href="https://github.com/takalard" target="_blank">takalard</a>
|
||||
校对:<a href="https://github.com/lifedim" target="_blank">lifedim</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-">泛型</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.23" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2.23" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,10 +587,11 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_630">
|
||||
<section class="normal" id="section-gitbook_52">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:xielingwang<br>校对:numbbbbb </p>
|
||||
<p>翻译:<a href="https://github.com/xielingwang" target="_blank">xielingwang</a>
|
||||
校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a></p>
|
||||
</blockquote>
|
||||
<h1 id="-">高级运算符</h1>
|
||||
<hr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261">
|
||||
<meta name="description" content="Swift 兴趣交流群:307017261Swift 开发者社区">
|
||||
<meta name="keywords" content="gitbook,github" >
|
||||
<meta name="generator" content="www.gitbook.io">
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2" data-basepath=".." data-revision="1402792177330">
|
||||
<div class="book" data-level="2" data-basepath=".." data-revision="1402808574723">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -587,7 +587,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_632">
|
||||
<section class="normal" id="section-gitbook_54">
|
||||
|
||||
<h1 id="swift-">Swift 教程</h1>
|
||||
<p>本章介绍了 Swift 的各种特性及其使用方法,是全书的核心部分。</p>
|
||||
|
||||
Reference in New Issue
Block a user