make gitbook
This commit is contained in:
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter1/02_a_swift_tour.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="1.1" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="1.1" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter1/01_swift.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_85">
|
||||
<section class="normal" id="section-gitbook_4">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a><br>校对:<a href="https://github.com/yeahdongcn" target="_blank">yeahdongcn</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/chapter2.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="1.2" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="1.2" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter1/02_a_swift_tour.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_87">
|
||||
<section class="normal" id="section-gitbook_6">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a><br>校对:<a href="https://github.com/shinyzhu" target="_blank">shinyzhu</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter1/01_swift.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="1" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="1" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter1/chapter1.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_89">
|
||||
<section class="normal" id="section-gitbook_8">
|
||||
|
||||
<h1 id="-swift">欢迎使用 Swift</h1>
|
||||
<p>在本章中您将了解 Swift 的特性和开发历史,并对 Swift 有一个初步的了解。</p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/02_Basic_Operators.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.1" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.1" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/01_The_Basics.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_92">
|
||||
<section class="normal" id="section-gitbook_11">
|
||||
|
||||
<blockquote>
|
||||
<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>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/03_Strings_and_Characters.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.2" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.2" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/02_Basic_Operators.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_113">
|
||||
<section class="normal" id="section-gitbook_32">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/xielingwang" target="_blank">xielingwang</a><br>校对:<a href="https://github.com/Evilcome" target="_blank">Evilcome</a></p>
|
||||
@ -591,13 +613,13 @@
|
||||
<li><a href="#range_operators">区间运算符</a></li>
|
||||
<li><a href="#logical_operators">逻辑运算符</a></li>
|
||||
</ul>
|
||||
<p>运算符是检查,改变,合并值的特殊符号或短语。例如,加号<code>+</code>将两个数相加(如<code>let i = 1 + 2</code>)。复杂些的运行算例如逻辑与运算符<code>&&</code>(如<code>if enteredDoorCode && passedRetinaScan</code>),又或让 i 值加1的便捷运算符自增运算符<code>++i</code>等。</p>
|
||||
<p>Swift 支持大部分标准 C 语言的运算符,且改进许多特性来减少常规编码错误。如,赋值符(<code>=</code>)不返回值,以防止把想要判断相等运算符(<code>==</code>)的地方写成赋值符导致的错误。数值运算符(<code>+</code>,<code>-</code>,<code>*</code>,<code>/</code>,<code>%</code>等)会检测并不允许值溢出,以此来避免保存变量时由于变量大于或小于其类型所能承载的范围时导致的异常结果。当然允许你使用 Swift 的溢出运算符来实现溢出。详情参见<a href="23_Advanced_Operators.html#overflow_operators">溢出运算符</a>。</p>
|
||||
<p>运算符是检查、改变、合并值的特殊符号或短语。例如,加号<code>+</code>将两个数相加(如<code>let i = 1 + 2</code>)。复杂些的运算例如逻辑与运算符<code>&&</code>(如<code>if enteredDoorCode && passedRetinaScan</code>),或让 i 值加1的便捷自增运算符<code>++i</code>等。</p>
|
||||
<p>Swift 支持大部分标准 C 语言的运算符,且改进许多特性来减少常规编码错误。如:赋值符(<code>=</code>)不返回值,以防止把想要判断相等运算符(<code>==</code>)的地方写成赋值符导致的错误。数值运算符(<code>+</code>,<code>-</code>,<code>*</code>,<code>/</code>,<code>%</code>等)会检测并不允许值溢出,以此来避免保存变量时由于变量大于或小于其类型所能承载的范围时导致的异常结果。当然允许你使用 Swift 的溢出运算符来实现溢出。详情参见<a href="23_Advanced_Operators.html#overflow_operators">溢出运算符</a>。</p>
|
||||
<p>区别于 C 语言,在 Swift 中你可以对浮点数进行取余运算(<code>%</code>),Swift 还提供了 C 语言没有的表达两数之间的值的区间运算符,(<code>a..b</code>和<code>a...b</code>),这方便我们表达一个区间内的数值。</p>
|
||||
<p>本章节只描述了 Swift 中的基本运算符,<a href="23_Advanced_Operators.html">高级运算符</a>包含了高级运算符,及如何自定义运算符,及如何进行自定义类型的运算符重载。</p>
|
||||
<p><a name="terminology"></a></p>
|
||||
<h2 id="-">术语</h2>
|
||||
<p>运算符有一元,二元和三元运算符。</p>
|
||||
<p>运算符有一元、二元和三元运算符。</p>
|
||||
<ul>
|
||||
<li>一元运算符对单一操作对象操作(如<code>-a</code>)。一元运算符分前置符和后置运算符,前置运算符需紧排操作对象之前(如<code>!b</code>),后置运算符需紧跟操作对象之后(如<code>i++</code>)。</li>
|
||||
<li>二元运算符操作两个操作对象(如<code>2 + 3</code>),是中置的,因为它们出现在两个操作对象之间。</li>
|
||||
@ -621,10 +643,10 @@ a = b
|
||||
// 此句错误, 因为 x = y 并不返回任何值
|
||||
}
|
||||
</code></pre>
|
||||
<p>这个特性使得你无法把(<code>==</code>)错写成(<code>=</code>)了,由于<code>if x = y</code>是错误代码,Swift 从底层帮你避免了这些代码错误。</p>
|
||||
<p>这个特性使你无法把(<code>==</code>)错写成(<code>=</code>),由于<code>if x = y</code>是错误代码,Swift 从底层帮你避免了这些错误代码。</p>
|
||||
<p><a name="arithmetic_operators"></a></p>
|
||||
<h2 id="-">数值运算</h2>
|
||||
<p>Swift 让所有数值类型都支持了基本的四则运算:</p>
|
||||
<p>Swift 中所有数值类型都支持了基本的四则运算:</p>
|
||||
<ul>
|
||||
<li>加法(<code>+</code>)</li>
|
||||
<li>减法(<code>-</code>)</li>
|
||||
@ -637,7 +659,7 @@ a = b
|
||||
10.0 / 2.5 // 等于 4.0
|
||||
</code></pre>
|
||||
<p>与 C 语言和 Objective-C 不同的是,Swift 默认不允许在数值运算中出现溢出情况。但你可以使用 Swift 的溢出运算符来达到你有目的的溢出(如<code>a &+ b</code>)。详情参见<a href="23_Advanced_Operators.html#overflow_operators">溢出运算符</a>。</p>
|
||||
<p>加法运算符也用于<code>String</code>的拼接:</p>
|
||||
<p>加法运算符也可用于<code>String</code>的拼接:</p>
|
||||
<pre><code class="lang-swift">"hello, " + "world" // 等于 "hello, world"
|
||||
</code></pre>
|
||||
<p>两个<code>Character</code>值或一个<code>String</code>和一个<code>Character</code>值,相加会生成一个新的<code>String</code>值:</p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/04_Collection_Types.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.3" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.3" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/03_Strings_and_Characters.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_94">
|
||||
<section class="normal" id="section-gitbook_13">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/wh1100717" target="_blank">wh1100717</a><br>校对:<a href="https://github.com/Hawstein" target="_blank">Hawstein</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/05_Control_Flow.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.4" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.4" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/04_Collection_Types.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_96">
|
||||
<section class="normal" id="section-gitbook_15">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/zqp" target="_blank">zqp</a><br>校对:<a href="https://github.com/shinyzhu" target="_blank">shinyzhu</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a> </p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/06_Functions.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.5" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.5" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/05_Control_Flow.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_100">
|
||||
<section class="normal" id="section-gitbook_17">
|
||||
|
||||
<blockquote>
|
||||
<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><br>校对:<a href="https://github.com/coverxit" target="_blank">coverxit</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/07_Closures.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.6" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.6" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/06_Functions.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_98">
|
||||
<section class="normal" id="section-gitbook_19">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/honghaoz" target="_blank">honghaoz</a><br>校对:<a href="https://github.com/LunaticM" target="_blank">LunaticM</a></p>
|
||||
@ -666,7 +688,7 @@ printWithoutCounting("hello, world")
|
||||
</code></pre>
|
||||
<p>第一个函数 <code>printAndCount</code>,输出一个字符串并返回 <code>Int</code> 类型的字符数。第二个函数 <code>printWithoutCounting</code>调用了第一个函数,但是忽略了它的返回值。当第二个函数被调用时,消息依然会由第一个函数输出,但是返回值不会被用到。</p>
|
||||
<blockquote>
|
||||
<p>注意:<br>返回值可以被忽略,但定义了有返回值的函数必须返回一个值,如果在函数定义底部没有返回任何值,这叫导致编译错误(compile-time error)。 </p>
|
||||
<p>注意:<br>返回值可以被忽略,但定义了有返回值的函数必须返回一个值,如果在函数定义底部没有返回任何值,这将导致编译错误(compile-time error)。 </p>
|
||||
</blockquote>
|
||||
<h3 id="-functions-with-multiple-return-values-">多重返回值函数(Functions with Multiple Return Values)</h3>
|
||||
<p>你可以用元组(tuple)类型让多个值作为一个复合值从函数中返回。</p>
|
||||
@ -692,7 +714,7 @@ printWithoutCounting("hello, world")
|
||||
println("\(total.vowels) vowels and \(total.consonants) consonants")
|
||||
// prints "6 vowels and 13 consonants"
|
||||
</code></pre>
|
||||
<p>需要注意的是,元组的成员不需要在函数中返回时命名,因为它们的名字已经在函数返回类型有有了定义。</p>
|
||||
<p>需要注意的是,元组的成员不需要在函数中返回时命名,因为它们的名字已经在函数返回类型中有了定义。</p>
|
||||
<p><a name="Function_Parameter_Names"></a></p>
|
||||
<h2 id="-function-parameter-names-">函数参数名称(Function Parameter Names)</h2>
|
||||
<p>以上所有的函数都给它们的参数定义了<code>参数名(parameter name)</code>:</p>
|
||||
@ -737,7 +759,7 @@ println("\(total.vowels) vowels and \(total.consonants) consonants")
|
||||
<p>注意:<br>当其他人在第一次读你的代码,函数参数的意图显得不明显时,考虑使用外部参数名。如果函数参数名的意图是很明显的,那就不需要定义外部参数名了。 </p>
|
||||
</blockquote>
|
||||
<h3 id="-shorthand-external-parameter-names-">简写外部参数名(Shorthand External Parameter Names)</h3>
|
||||
<p>如果你需要提供外部参数名,但是局部参数名已经定义好了,那么你不需要写两次这些参数名。相反,只写一次参数名,并用<code>井号(#)</code>作为前缀就可以了。这告诉 Swift 使用这个参数名作为局部和外部参数名。</p>
|
||||
<p>如果你需要提供外部参数名,但是局部参数名已经定义好了,那么你不需要写两次参数名。相反,只写一次参数名,并用<code>井号(#)</code>作为前缀就可以了。这告诉 Swift 使用这个参数名作为局部和外部参数名。</p>
|
||||
<p>下面这个例子定义了一个叫 <code>containsCharacter</code> 的函数,使用<code>井号(#)</code>的方式定义了外部参数名:</p>
|
||||
<pre><code class="lang-swift">func containsCharacter(#string: String, #characterToFind: Character) -> Bool {
|
||||
for character in string {
|
||||
@ -753,9 +775,9 @@ println("\(total.vowels) vowels and \(total.consonants) consonants")
|
||||
// containsAVee equals true, because "aardvark" contains a "v”
|
||||
</code></pre>
|
||||
<h3 id="-default-parameter-values-">默认参数值(Default Parameter Values)</h3>
|
||||
<p>你可以在函数体中为每个参数定义<code>默认值</code>。当默认值被定义后,调用这个函数时可以略去这个参数。</p>
|
||||
<p>你可以在函数体中为每个参数定义<code>默认值</code>。当默认值被定义后,调用这个函数时可以忽略这个参数。</p>
|
||||
<blockquote>
|
||||
<p>注意:<br>将带有默认值的参数放在函数参数表的最后。这样可以保证在函数调用时,非默认参数的顺序是一致的,同时使得相同的函数在不同情况下调用时显得更为清晰。 </p>
|
||||
<p>注意:<br>将带有默认值的参数放在函数参数列表的最后。这样可以保证在函数调用时,非默认参数的顺序是一致的,同时使得相同的函数在不同情况下调用时显得更为清晰。 </p>
|
||||
</blockquote>
|
||||
<p>以下是另一个版本的<code>join</code>函数,其中<code>joiner</code>有了默认参数值:</p>
|
||||
<pre><code class="lang-swift">func join(string s1: String, toString s2: String, withJoiner joiner: String = " ") -> String {
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/08_Enumerations.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.7" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.7" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/07_Closures.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_102">
|
||||
<section class="normal" id="section-gitbook_21">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/wh1100717" target="_blank">wh1100717</a><br>校对:<a href="https://github.com/lyuka" target="_blank">lyuka</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/09_Classes_and_Structures.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.8" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.8" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/08_Enumerations.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_104">
|
||||
<section class="normal" id="section-gitbook_23">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/yankuangshi" target="_blank">yankuangshi</a><br>校对:<a href="https://github.com/shinyzhu" target="_blank">shinyzhu</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/10_Properties.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.9" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.9" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/09_Classes_and_Structures.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_106">
|
||||
<section class="normal" id="section-gitbook_25">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/JaySurplus" target="_blank">JaySurplus</a><br>校对:<a href="https://github.com/sg552" target="_blank">sg552</a></p>
|
||||
@ -587,7 +609,7 @@
|
||||
<li><a href="#choosing_between_classes_and_structures">类和结构体的选择</a></li>
|
||||
<li><a href="#assignment_and_copy_behavior_for_collection_types">集合(collection)类型的赋值与复制行为</a></li>
|
||||
</ul>
|
||||
<p>类和结构体是人们构建代码所用的一种通用且灵活的构造体。为了在类和结构体中实现各种功能,我们必须要严格按照对于常量,变量以及函数所规定的语法规则来定义属性和添加方法。</p>
|
||||
<p>类和结构体是人们构建代码所用的一种通用且灵活的构造体。为了在类和结构体中实现各种功能,我们必须要严格按照常量、变量以及函数所规定的语法规则来定义属性和添加方法。</p>
|
||||
<p>与其他编程语言所不同的是,Swift 并不要求你为自定义类和结构去创建独立的接口和实现文件。你所要做的是在一个单一文件中定义一个类或者结构体,系统将会自动生成面向其它代码的外部接口。</p>
|
||||
<blockquote>
|
||||
<p> 注意:<br>通常一个<code>类</code>的实例被称为<code>对象</code>。然而在Swift 中,类和结构体的关系要比在其他语言中更加的密切,本章中所讨论的大部分功能都可以用在类和结构体上。因此,我们会主要使用<code>实例</code>而不是<code>对象</code>。</p>
|
||||
@ -596,7 +618,7 @@
|
||||
<h3 id="-">类和结构体对比</h3>
|
||||
<p>Swift 中类和结构体有很多共同点。共同处在于:</p>
|
||||
<ul>
|
||||
<li>定义属性用于储存值</li>
|
||||
<li>定义属性用于存储值</li>
|
||||
<li>定义方法用于提供功能</li>
|
||||
<li>定义附属脚本用于访问值</li>
|
||||
<li>定义构造器用于生成初始化值</li>
|
||||
@ -639,8 +661,8 @@ class VideoMode {
|
||||
var name: String?
|
||||
}
|
||||
</code></pre>
|
||||
<p>在上面的示例中我们定义了一个名为<code>Resolution</code>的结构体,用来描述一个显示器的像素分辨率。这个结构体包含了两个名为<code>width</code>和<code>height</code>的储存属性。储存属性是捆绑和储存在类或结构体中的常量或变量。当这两个属性被初始化为整数<code>0</code>的时候,它们会被推断为<code>Int</code>类型。</p>
|
||||
<p>在上面的示例中我们还定义了一个名为<code>VideoMode</code>的类,用来描述一个视频显示器的特定模式。这个类包含了四个储存属性变量。第一个是<code>分辨率</code>,它被初始化为一个新的<code>Resolution</code>结构体的实例,具有<code>Resolution</code>的属性类型。新<code>VideoMode</code>实例同时还会初始化其它三个属性,它们分别是,初始值为<code>false</code>(意为“non-interlaced video”)的<code>interlaced</code>,回放帧率初始值为<code>0.0</code>的<code>frameRate</code>和值为可选<code>String</code>的<code>name</code>。<code>name</code>属性会被自动赋予一个默认值<code>nil</code>,意为“没有<code>name</code>值”,因它是一个可选类型。</p>
|
||||
<p>在上面的示例中我们定义了一个名为<code>Resolution</code>的结构体,用来描述一个显示器的像素分辨率。这个结构体包含了两个名为<code>width</code>和<code>height</code>的存储属性。存储属性是捆绑和存储在类或结构体中的常量或变量。当这两个属性被初始化为整数<code>0</code>的时候,它们会被推断为<code>Int</code>类型。</p>
|
||||
<p>在上面的示例中我们还定义了一个名为<code>VideoMode</code>的类,用来描述一个视频显示器的特定模式。这个类包含了四个储存属性变量。第一个是<code>分辨率</code>,它被初始化为一个新的<code>Resolution</code>结构体的实例,具有<code>Resolution</code>的属性类型。新<code>VideoMode</code>实例同时还会初始化其它三个属性,它们分别是,初始值为<code>false</code>(意为“non-interlaced video”)的<code>interlaced</code>,回放帧率初始值为<code>0.0</code>的<code>frameRate</code>和值为可选<code>String</code>的<code>name</code>。<code>name</code>属性会被自动赋予一个默认值<code>nil</code>,意为“没有<code>name</code>值”,因为它是一个可选类型。</p>
|
||||
<h3 id="-">类和结构体实例</h3>
|
||||
<p><code>Resolution</code>结构体和<code>VideoMode</code>类的定义仅描述了什么是<code>Resolution</code>和<code>VideoMode</code>。它们并没有描述一个特定的分辨率(resolution)或者视频模式(video mode)。为了描述一个特定的分辨率或者视频模式,我们需要生成一个它们的实例。</p>
|
||||
<p>生成结构体和类实例的语法非常相似:</p>
|
||||
@ -649,7 +671,7 @@ let someVideoMode = VideoMode()
|
||||
</code></pre>
|
||||
<p>结构体和类都使用构造器语法来生成新的实例。构造器语法的最简单形式是在结构体或者类的类型名称后跟随一个空括弧,如<code>Resolution()</code>或<code>VideoMode()</code>。通过这种方式所创建的类或者结构体实例,其属性均会被初始化为默认值。<a href="14_Initialization.html">构造过程</a>章节会对类和结构体的初始化进行更详细的讨论。</p>
|
||||
<h3 id="-">属性访问</h3>
|
||||
<p>通过使用<em>点语法</em>(<em>dot syntax</em>),你可以访问实例中所含有的属性。其语法规则是,实例名后面紧跟属性名,两者通过点号(.)连接:</p>
|
||||
<p>通过使用<em>点语法</em>(<em>dot syntax</em>),你可以访问实例中所含有的属性。其语法规则是,实例名后面紧跟属性名,两者通过点号(.)连接:</p>
|
||||
<pre><code class="lang-swift">println("The width of someResolution is \(someResolution.width)")
|
||||
// 输出 "The width of someResolution is 0"
|
||||
</code></pre>
|
||||
@ -693,7 +715,7 @@ var cinema = hd
|
||||
<pre><code class="lang-swift">println("hd is still \(hd.width ) pixels wide")
|
||||
// 输出 "hd is still 1920 pixels wide"
|
||||
</code></pre>
|
||||
<p>在将<code>hd</code>赋予给<code>cinema</code>的时候,实际上是将<code>hd</code>中所储存的<code>值(values)</code>进行拷贝,然后将拷贝的数据储存到新的<code>cinema</code>实例中。结果就是两个完全独立的实例碰巧包含有相同的数值。由于两者相互独立,因此将<code>cinema</code>的<code>width</code>修改为<code>2048</code>并不会影响<code>hd</code>中的宽(width)。</p>
|
||||
<p>在将<code>hd</code>赋予给<code>cinema</code>的时候,实际上是将<code>hd</code>中所存储的<code>值(values)</code>进行拷贝,然后将拷贝的数据存储到新的<code>cinema</code>实例中。结果就是两个完全独立的实例碰巧包含有相同的数值。由于两者相互独立,因此将<code>cinema</code>的<code>width</code>修改为<code>2048</code>并不会影响<code>hd</code>中的宽(width)。</p>
|
||||
<p>枚举也遵循相同的行为准则:</p>
|
||||
<pre><code class="lang-swift">enum CompassPoint {
|
||||
case North, South, East, West
|
||||
@ -709,7 +731,7 @@ if rememberDirection == .West {
|
||||
<p>上例中<code>rememberedDirection</code>被赋予了<code>currentDirection</code>的值(value),实际上它被赋予的是值(value)的一个拷贝。赋值过程结束后再修改<code>currentDirection</code>的值并不影响<code>rememberedDirection</code>所储存的原始值(value)的拷贝。</p>
|
||||
<p><a name="classes_are_reference_types"></a></p>
|
||||
<h2 id="-">类是引用类型</h2>
|
||||
<p>与值类型不同,引用类型在被赋予到一个变量,常量或者被传递到一个函数时,操作的并不是其拷贝。因此,引用的是已存在的实例本身而不是其拷贝。</p>
|
||||
<p>与值类型不同,引用类型在被赋予到一个变量、常量或者被传递到一个函数时,操作的是引用,其并不是拷贝。因此,引用的是已存在的实例本身而不是其拷贝。</p>
|
||||
<p>请看下面这个示例,其使用了之前定义的<code>VideoMode</code>类:</p>
|
||||
<pre><code class="lang-swift">let tenEighty = VideoMode()
|
||||
tenEighty.resolution = hd
|
||||
@ -722,14 +744,14 @@ tenEighty.frameRate = 25.0
|
||||
<pre><code class="lang-swift">let alsoTenEighty = tenEighty
|
||||
alsoTenEighty.frameRate = 30.0
|
||||
</code></pre>
|
||||
<p>因为类是引用类型,所以<code>tenEight</code>和<code>alsoTenEight</code>实际上引用的是相同的<code>VideoMode</code>实例。换句话说,它们只是同一个实例的两种叫法。</p>
|
||||
<p>因为类是引用类型,所以<code>tenEight</code>和<code>alsoTenEight</code>实际上引用的是相同的<code>VideoMode</code>实例。换句话说,它们是同一个实例的两种叫法。</p>
|
||||
<p>下面,通过查看<code>tenEighty</code>的<code>frameRate</code>属性,我们会发现它正确的显示了基本<code>VideoMode</code>实例的新帧率,其值为<code>30.0</code>:</p>
|
||||
<pre><code class="lang-swift">println("The frameRate property of tenEighty is now \(tenEighty.frameRate)")
|
||||
// 输出 "The frameRate property of theEighty is now 30.0"
|
||||
</code></pre>
|
||||
<p>需要注意的是<code>tenEighty</code>和<code>alsoTenEighty</code>被声明为<em>常量((constants)</em>而不是变量。然而你依然可以改变<code>tenEighty.frameRate</code>和<code>alsoTenEighty.frameRate</code>,因为这两个常量本身不会改变。它们并不<code>储存</code>这个<code>VideoMode</code>实例,在后台仅仅是对<code>VideoMode</code>实例的引用。所以,改变的是被引用的基础<code>VideoMode</code>的<code>frameRate</code>参数,而不改变常量的值。</p>
|
||||
<p>需要注意的是<code>tenEighty</code>和<code>alsoTenEighty</code>被声明为<em>常量((constants)</em>而不是变量。然而你依然可以改变<code>tenEighty.frameRate</code>和<code>alsoTenEighty.frameRate</code>,因为这两个常量本身不会改变。它们并不<code>存储</code>这个<code>VideoMode</code>实例,在后台仅仅是对<code>VideoMode</code>实例的引用。所以,改变的是被引用的基础<code>VideoMode</code>的<code>frameRate</code>参数,而不改变常量的值。</p>
|
||||
<h3 id="-">恒等运算符</h3>
|
||||
<p>因为类是引用类型,有可能有多个常量和变量在后台同时引用某一个类实例。(对于结构体和枚举来说,这并不成立。因为它们作值类型,在被赋予到常量,变量或者传递到函数时,总是会被拷贝。)</p>
|
||||
<p>因为类是引用类型,有可能有多个常量和变量在后台同时引用某一个类实例。(对于结构体和枚举来说,这并不成立。因为它们作为值类型,在被赋予到常量、变量或者传递到函数时,其值总是会被拷贝。)</p>
|
||||
<p>如果能够判定两个常量或者变量是否引用同一个类实例将会很有帮助。为了达到这个目的,Swift 内建了两个恒等运算符:</p>
|
||||
<ul>
|
||||
<li>等价于 ( === )</li>
|
||||
@ -741,7 +763,7 @@ alsoTenEighty.frameRate = 30.0
|
||||
}
|
||||
//输出 "tenEighty and alsoTenEighty refer to the same Resolution instance."
|
||||
</code></pre>
|
||||
<p>请注意“等价于”(用三个等号表示,===) 与“等于”(用两个等号表示,==)的不同:</p>
|
||||
<p>请注意<code>“等价于"</code>(用三个等号表示,===) 与<code>“等于"</code>(用两个等号表示,==)的不同:</p>
|
||||
<ul>
|
||||
<li>“等价于”表示两个类类型(class type)的常量或者变量引用同一个类实例。</li>
|
||||
<li>“等于”表示两个实例的值“相等”或“相同”,判定时要遵照类设计者定义定义的评判标准,因此相比于“相等”,这是一种更加合适的叫法。</li>
|
||||
@ -752,7 +774,7 @@ alsoTenEighty.frameRate = 30.0
|
||||
<p><a name="choosing_between_classes_and_structures"></a></p>
|
||||
<h2 id="-">类和结构体的选择</h2>
|
||||
<p>在你的代码中,你可以使用类和结构体来定义你的自定义数据类型。</p>
|
||||
<p>然而,结构体实例总是通过值传递,类实例总是通过引用传递。这意味两者适用不同的任务。当你的在考虑一个工程项目的数据构造和功能的时候,你需要决定每个数据构造是定义成类还是结构体。</p>
|
||||
<p>然而,结构体实例总是通过值传递,类实例总是通过引用传递。这意味两者适用不同的任务。当你在考虑一个工程项目的数据构造和功能的时候,你需要决定每个数据构造是定义成类还是结构体。</p>
|
||||
<p>按照通用的准则,当符合一条或多条以下条件时,请考虑构建结构体:</p>
|
||||
<ul>
|
||||
<li>结构体的主要目的是用来封装少量相关简单数据值。</li>
|
||||
@ -861,12 +883,12 @@ println(c[0])
|
||||
// 输出 "These two subarrays share the same elements."
|
||||
</code></pre>
|
||||
<h3 id="-">强制复制数组</h3>
|
||||
<p>我们通过调用数组的<code>copy</code>方法进行强制显性复制。这个方法对数组进行了浅拷贝(shallow copy),并且返回一个包含此拷贝的新数组。</p>
|
||||
<p>我们通过调用数组的<code>copy</code>方法进行强制显式复制。这个方法对数组进行了浅拷贝(shallow copy),并且返回一个包含此拷贝数组的新数组。</p>
|
||||
<p>下面这个示例中定义了一个<code>names</code>数组,其包含了七个人名。还定义了一个<code>copiedNames</code>变量,用以储存在<code>names</code>上调用<code>copy</code>方法所返回的结果:</p>
|
||||
<pre><code class="lang-swift">var names = ["Mohsen", "Hilary", "Justyn", "Amy", "Rich", "Graham", "Vic"]
|
||||
var copiedNames = names.copy()
|
||||
</code></pre>
|
||||
<p>我们可以通过修改一个数组中某元素,并且检查另一个数组中对应元素的方法来判定<code>names</code>数组确已被复制。如果你将<code>copiedNames</code>中第一个元素从"<code>Mohsen</code>"修改为"<code>Mo</code>",则<code>names</code>数组返回的仍是拷贝发生前的"<code>Mohsen</code>":</p>
|
||||
<p>我们可以通过修改数组中某一个元素,并且检查另一个数组中对应元素的方法来判定<code>names</code>数组确已被复制。如果你将<code>copiedNames</code>中第一个元素从"<code>Mohsen</code>"修改为"<code>Mo</code>",则<code>names</code>数组返回的仍是拷贝发生前的"<code>Mohsen</code>":</p>
|
||||
<pre><code class="lang-swift">copiedName[0] = "Mo"
|
||||
println(name[0])
|
||||
// 输出 "Mohsen"
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/11_Methods.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.10" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.10" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/10_Properties.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_109">
|
||||
<section class="normal" id="section-gitbook_26">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/shinyzhu" target="_blank">shinyzhu</a><br>校对:<a href="https://github.com/pp-prog" target="_blank">pp-prog</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/12_Subscripts.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.11" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.11" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/11_Methods.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_107">
|
||||
<section class="normal" id="section-gitbook_28">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/pp-prog" target="_blank">pp-prog</a><br>校对:<a href="https://github.com/zqp" target="_blank">zqp</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/13_Inheritance.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.12" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.12" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/12_Subscripts.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_111">
|
||||
<section class="normal" id="section-gitbook_30">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/siemenliu" target="_blank">siemenliu</a><br>校对:<a href="https://github.com/zq54zquan" target="_blank">zq54zquan</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/14_Initialization.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.13" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.13" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/13_Inheritance.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_90">
|
||||
<section class="normal" id="section-gitbook_9">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/Hawstein" target="_blank">Hawstein</a><br>校对:<a href="https://github.com/menlongsheng" target="_blank">menlongsheng</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/15_Deinitialization.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.14" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.14" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/14_Initialization.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_115">
|
||||
<section class="normal" id="section-gitbook_34">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/lifedim" target="_blank">lifedim</a><br>校对:<a href="https://github.com/lifedim" target="_blank">lifedim</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/16_Automatic_Reference_Counting.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.15" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.15" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/15_Deinitialization.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_117">
|
||||
<section class="normal" id="section-gitbook_36">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/bruce0505" target="_blank">bruce0505</a><br>校对:<a href="https://github.com/fd5788" target="_blank">fd5788</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/17_Optional_Chaining.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.16" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.16" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/16_Automatic_Reference_Counting.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_119">
|
||||
<section class="normal" id="section-gitbook_38">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/TimothyYe" target="_blank">TimothyYe</a><br>校对:<a href="https://github.com/Hawstein" target="_blank">Hawstein</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/18_Type_Casting.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.17" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.17" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/17_Optional_Chaining.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_121">
|
||||
<section class="normal" id="section-gitbook_40">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/Jasonbroker" target="_blank">Jasonbroker</a><br>校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/19_Nested_Types.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.18" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.18" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/18_Type_Casting.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_123">
|
||||
<section class="normal" id="section-gitbook_42">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/xiehurricane" target="_blank">xiehurricane</a><br>校对:<a href="https://github.com/happyming" target="_blank">happyming</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/20_Extensions.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.19" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.19" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/19_Nested_Types.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_125">
|
||||
<section class="normal" id="section-gitbook_44">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/Lin-H" target="_blank">Lin-H</a><br>校对:<a href="https://github.com/shinyzhu" target="_blank">shinyzhu</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/21_Protocols.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.20" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.20" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/20_Extensions.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_127">
|
||||
<section class="normal" id="section-gitbook_46">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/lyuka" target="_blank">lyuka</a><br>校对:<a href="https://github.com/Hawstein" target="_blank">Hawstein</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/22_Generics.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.21" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.21" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/21_Protocols.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_129">
|
||||
<section class="normal" id="section-gitbook_48">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/geek5nan" target="_blank">geek5nan</a><br>校对:<a href="https://github.com/dabing1022" target="_blank">dabing1022</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/23_Advanced_Operators.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.22" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.22" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/22_Generics.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_131">
|
||||
<section class="normal" id="section-gitbook_50">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/takalard" target="_blank">takalard</a><br>校对:<a href="https://github.com/lifedim" target="_blank">lifedim</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/chapter3.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.23" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2.23" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/23_Advanced_Operators.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_133">
|
||||
<section class="normal" id="section-gitbook_52">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/xielingwang" target="_blank">xielingwang</a><br>校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a></p>
|
||||
@ -739,23 +761,18 @@ let y = x &/ 0
|
||||
</code></pre>
|
||||
<p>如果严格地从左计算到右,计算过程会是这样:</p>
|
||||
<ul>
|
||||
<li>2 plus 3 equals 5;</li>
|
||||
<li>2 + 3 = 5</li>
|
||||
<li>5 times 4 equals 20;</li>
|
||||
<li>5 * 4 = 20</li>
|
||||
<li>20 remainder 5 equals 0</li>
|
||||
<li>20 / 5 = 4 余 0</li>
|
||||
</ul>
|
||||
<p>但是正确答案是<code>4</code>而不是<code>0</code>。优先级高的运算符要先计算,在Swift和C语言中,都是先乘除后加减的。所以,执行完乘法和求余运算才能执行加减运算。</p>
|
||||
<p>乘法和求余拥有相同的优先级,在运算过程中,我们还需要结合性,乘法和求余运算都是左结合的。这相当于在表达式中有隐藏的括号让运算从左开始。</p>
|
||||
<pre><code class="lang-swift">2 + ((3 * 4) % 5)
|
||||
</code></pre>
|
||||
<p>(3 <em> 4) is 12, so this is equivalent to:
|
||||
3 </em> 4 = 12,所以这相当于:</p>
|
||||
<p>3 * 4 = 12,所以这相当于:</p>
|
||||
<pre><code class="lang-swift">2 + (12 % 5)
|
||||
</code></pre>
|
||||
<p>(12 % 5) is 2, so this is equivalent to:
|
||||
12 % 5 = 2,所这又相当于</p>
|
||||
<p>12 % 5 = 2,所这又相当于</p>
|
||||
<pre><code class="lang-swift">2 + 2
|
||||
</code></pre>
|
||||
<p>计算结果为 4。</p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter2/01_The_Basics.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="2" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter2/chapter2.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_135">
|
||||
<section class="normal" id="section-gitbook_54">
|
||||
|
||||
<h1 id="swift-">Swift 教程</h1>
|
||||
<p>本章介绍了 Swift 的各种特性及其使用方法,是全书的核心部分。</p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/02_Lexical_Structure.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3.1" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3.1" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/01_About_the_Language_Reference.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_138">
|
||||
<section class="normal" id="section-gitbook_57">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/dabing1022" target="_blank">dabing1022</a><br>校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/03_Types.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3.2" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3.2" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/02_Lexical_Structure.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_146">
|
||||
<section class="normal" id="section-gitbook_63">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/superkam" target="_blank">superkam</a><br>校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/04_Expressions.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3.3" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3.3" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/03_Types.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_140">
|
||||
<section class="normal" id="section-gitbook_59">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/lyuka" target="_blank">lyuka</a><br>校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/10_Statements.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3.4" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3.4" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/04_Expressions.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_142">
|
||||
<section class="normal" id="section-gitbook_61">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/sg552" target="_blank">sg552</a><br>校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/06_Attributes.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3.6" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3.6" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/05_Declarations.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_144">
|
||||
<section class="normal" id="section-gitbook_67">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/marsprince" target="_blank">marsprince</a><br>校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/07_Patterns.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3.7" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3.7" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/06_Attributes.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_136">
|
||||
<section class="normal" id="section-gitbook_55">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/Hawstein" target="_blank">Hawstein</a><br>校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/08_Generic_Parameters_and_Arguments.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3.8" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3.8" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/07_Patterns.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_148">
|
||||
<section class="normal" id="section-gitbook_65">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/honghaoz" target="_blank">honghaoz</a><br>校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/09_Summary_of_the_Grammar.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3.9" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3.9" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/08_Generic_Parameters_and_Arguments.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_150">
|
||||
<section class="normal" id="section-gitbook_69">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/fd5788" target="_blank">fd5788</a><br>校对:<a href="https://github.com/yankuangshi" target="_blank">yankuangshi</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
|
||||
<link rel="prev" href="../chapter3/08_Generic_Parameters_and_Arguments.html" />
|
||||
@ -30,12 +32,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3.10" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3.10" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -78,6 +80,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -95,12 +100,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/09_Summary_of_the_Grammar.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -571,7 +593,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_154">
|
||||
<section class="normal" id="section-gitbook_71">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/stanzhai" target="_blank">stanzhai</a><br>校对:<a href="https://github.com/xielingwang" target="_blank">xielingwang</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/05_Declarations.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3.5" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3.5" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/10_Statements.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
@ -573,7 +595,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_152">
|
||||
<section class="normal" id="section-gitbook_73">
|
||||
|
||||
<blockquote>
|
||||
<p>翻译:<a href="https://github.com/coverxit" target="_blank">coverxit</a><br>校对:<a href="https://github.com/numbbbbb" target="_blank">numbbbbb</a>, <a href="https://github.com/coverxit" target="_blank">coverxit</a>, <a href="https://github.com/stanzhai" target="_blank">stanzhai</a></p>
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="../chapter3/01_About_the_Language_Reference.html" />
|
||||
|
||||
@ -32,12 +34,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="3" data-basepath=".." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="3" data-basepath=".." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -80,6 +82,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -97,12 +102,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/chapter3/chapter3.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="../"><i class="fa fa-check"></i> 序</a>
|
||||
|
||||
BIN
cover_small.jpg
Normal file
BIN
cover_small.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
30
index.html
30
index.html
@ -16,6 +16,8 @@
|
||||
|
||||
|
||||
|
||||
<meta name="author" content="https:">
|
||||
|
||||
|
||||
<link rel="next" href="./chapter1/chapter1.html" />
|
||||
|
||||
@ -30,12 +32,12 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="0" data-basepath="." data-revision="1402903834498">
|
||||
<div class="book" data-github="https://github.com/numbbbbb/the-swift-programming-language-in-chinese" data-level="0" data-basepath="." data-revision="1402929590291">
|
||||
<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>
|
||||
|
||||
<a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
|
||||
|
||||
<a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
|
||||
<span id="font-settings-wrapper">
|
||||
@ -78,6 +80,9 @@
|
||||
|
||||
|
||||
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/stargazers" target="_blank" class="btn pull-right count-star hidden-xs"><i class="fa fa-star-o"></i> Star (<span>-</span>)</a>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/watchers" target="_blank" class="btn pull-right count-watch hidden-xs"><i class="fa fa-eye"></i> Watch (<span>-</span>)</a>
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
@ -95,12 +100,29 @@
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https:" target="blank" class="author-link">About the author</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/issues" target="blank"class="issues-link">Questions and Issues</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a href="https://github.com/https://github.com/numbbbbb/the-swift-programming-language-in-chinese/edit/master/README.md" target="blank" class="contribute-link">Edit and Contribute</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
|
||||
<li data-level="0" data-path="index.html">
|
||||
<a href="./"><i class="fa fa-check"></i> 序</a>
|
||||
@ -571,7 +593,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_84">
|
||||
<section class="normal" id="section-gitbook_3">
|
||||
|
||||
<blockquote>
|
||||
<p>Swift 兴趣交流群:<code>305014012</code>,307017261(已满)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
CACHE MANIFEST
|
||||
# Revision 1402903834499
|
||||
# Revision 1402929590292
|
||||
|
||||
CACHE:
|
||||
index.html
|
||||
@ -10,13 +10,13 @@ chapter2/13_Inheritance.html
|
||||
chapter2/01_The_Basics.html
|
||||
chapter2/03_Strings_and_Characters.html
|
||||
chapter2/04_Collection_Types.html
|
||||
chapter2/06_Functions.html
|
||||
chapter2/05_Control_Flow.html
|
||||
chapter2/06_Functions.html
|
||||
chapter2/07_Closures.html
|
||||
chapter2/08_Enumerations.html
|
||||
chapter2/09_Classes_and_Structures.html
|
||||
chapter2/11_Methods.html
|
||||
chapter2/10_Properties.html
|
||||
chapter2/11_Methods.html
|
||||
chapter2/12_Subscripts.html
|
||||
chapter2/02_Basic_Operators.html
|
||||
chapter2/14_Initialization.html
|
||||
@ -34,12 +34,12 @@ chapter3/06_Attributes.html
|
||||
chapter3/01_About_the_Language_Reference.html
|
||||
chapter3/03_Types.html
|
||||
chapter3/04_Expressions.html
|
||||
chapter3/05_Declarations.html
|
||||
chapter3/02_Lexical_Structure.html
|
||||
chapter3/07_Patterns.html
|
||||
chapter3/05_Declarations.html
|
||||
chapter3/08_Generic_Parameters_and_Arguments.html
|
||||
chapter3/10_Statements.html
|
||||
chapter3/09_Summary_of_the_Grammar.html
|
||||
chapter3/10_Statements.html
|
||||
chapter3/chapter3.html
|
||||
gitbook/app.js
|
||||
gitbook/fonts/fontawesome/FontAwesome.otf
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user