update closure
This commit is contained in:
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="1.1" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="1.1" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,7 +576,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_4">
|
<section class="normal" id="section-gitbook_6">
|
||||||
|
|
||||||
<h1 id="-swift">关于 Swift</h1>
|
<h1 id="-swift">关于 Swift</h1>
|
||||||
<p>Swift 是一种新的编程语言,用于编写 iOS 和 OS X 应用程序。Swift 结合了 C 和 Objective-C 的优点并且不受C的兼容性的限制。Swift 使用安全的编程模式并添加了很多新特性,这将使编程更简单,扩展性更强,也更有趣。除此之外,Swift 还支持人见人爱的 Cocoa 和 Cocoa Touch 框架。拥有了这些特性,Swift将重新定义软件开发。</p>
|
<p>Swift 是一种新的编程语言,用于编写 iOS 和 OS X 应用程序。Swift 结合了 C 和 Objective-C 的优点并且不受C的兼容性的限制。Swift 使用安全的编程模式并添加了很多新特性,这将使编程更简单,扩展性更强,也更有趣。除此之外,Swift 还支持人见人爱的 Cocoa 和 Cocoa Touch 框架。拥有了这些特性,Swift将重新定义软件开发。</p>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="1.2" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="1.2" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,7 +576,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_5">
|
<section class="normal" id="section-gitbook_7">
|
||||||
|
|
||||||
<h1 id="swift-">Swift 初见</h1>
|
<h1 id="swift-">Swift 初见</h1>
|
||||||
<p>通常来说,编程语言教程中的第一个程序应该在屏幕上打印“Hello, world”。在 Swift 中,可以用一行代码实现:</p>
|
<p>通常来说,编程语言教程中的第一个程序应该在屏幕上打印“Hello, world”。在 Swift 中,可以用一行代码实现:</p>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="1" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="1" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,7 +576,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_6">
|
<section class="normal" id="section-gitbook_8">
|
||||||
|
|
||||||
<h1 id="-swift">欢迎使用 Swift</h1>
|
<h1 id="-swift">欢迎使用 Swift</h1>
|
||||||
<p>在本章中您将了解 Swift 的特性和开发历史,并对 Swift 有一个初步的了解。</p>
|
<p>在本章中您将了解 Swift 的特性和开发历史,并对 Swift 有一个初步的了解。</p>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.1" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.1" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,7 +576,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_8">
|
<section class="normal" id="section-gitbook_10">
|
||||||
|
|
||||||
<h1 id="-">基础部分</h1>
|
<h1 id="-">基础部分</h1>
|
||||||
<p>Swift 是 iOS 和 OS X 应用开发的一门新语言。然而,如果你有 C 或者 Objective-C 开发经验的话,你会发现 Swift 的很多内容都是你熟悉的。</p>
|
<p>Swift 是 iOS 和 OS X 应用开发的一门新语言。然而,如果你有 C 或者 Objective-C 开发经验的话,你会发现 Swift 的很多内容都是你熟悉的。</p>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.2" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.2" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.3" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.3" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,20 +576,28 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_9">
|
<section class="normal" id="section-gitbook_11">
|
||||||
|
|
||||||
<h1 id="-strings-and-characters-">字符串和字符 (Strings and Characters)</h1>
|
<h1 id="-strings-and-characters-">字符串和字符 (Strings and Characters)</h1>
|
||||||
<p><strong>String</strong> 是一个有序的字符集合,例如 "hello, world", "albatross"。Swift 字符串通过 <strong>String</strong> 类型来表示,也可以表示为 <strong>Character</strong> 类型值的集合。</p>
|
<p><strong>String</strong> 是一个有序的字符集合,例如 "hello, world", "albatross"。
|
||||||
<p>Swift 的 <strong>String</strong> 和 <strong>Character</strong> 类型提供了一个快速的,兼容 Unicode 的方式来处理代码中的文本信息。创建和操作字符串的语法与 C的操作方式相似,轻量并且易读。字符串连接操作只需要简单地通过 <code>+</code> 号将两个字符串相连即可。与 Swift 中其他值一样,能否更改字符串的值,取决于其被定义为常量还是变量。</p>
|
Swift 字符串通过 <strong>String</strong> 类型来表示,也可以表示为 <strong>Character</strong> 类型值的集合。</p>
|
||||||
<p>尽管语法简易,但 <strong>String</strong> 类型是一种快速、现代化的字符串实现。每一个字符串都是由独立编码的 Unicode 字符组成,并提供了用于访问这些字符在不同的Unicode表示的支持。</p>
|
<p>Swift 的 <strong>String</strong> 和 <strong>Character</strong> 类型提供了一个快速的,兼容 Unicode 的方式来处理代码中的文本信息。
|
||||||
|
创建和操作字符串的语法与 C的操作方式相似,轻量并且易读。
|
||||||
|
字符串连接操作只需要简单地通过 <code>+</code> 号将两个字符串相连即可。
|
||||||
|
与 Swift 中其他值一样,能否更改字符串的值,取决于其被定义为常量还是变量。</p>
|
||||||
|
<p>尽管语法简易,但 <strong>String</strong> 类型是一种快速、现代化的字符串实现。
|
||||||
|
每一个字符串都是由独立编码的 Unicode 字符组成,并提供了用于访问这些字符在不同的Unicode表示的支持。</p>
|
||||||
<p><strong>String</strong> 也可以用于在常量、变量、字面量和表达式中进行字符串插值,这使得创建用于展示、存储和打印的字符串变得轻松自如。</p>
|
<p><strong>String</strong> 也可以用于在常量、变量、字面量和表达式中进行字符串插值,这使得创建用于展示、存储和打印的字符串变得轻松自如。</p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p>注意:</p>
|
<p>注意:</p>
|
||||||
<p>Swift 的 <strong>String</strong> 类型与 Foundation NSString 类进行了无缝桥接。如果您利用 Cocoa 或 Cocoa Touch 中的 Foundation 框架进行工作,整个 NSString API 都可以调用您创建的任意 String 类型的值,您额外还可以在任意 API 中使用本章介绍的 <strong>String</strong> 特性。您也可以在任意要求传入NSString 实例作为参数的 API 中使用 <strong>String</strong> 类型的值进行替换。</p>
|
<p>Swift 的 <strong>String</strong> 类型与 Foundation NSString 类进行了无缝桥接。
|
||||||
|
如果您利用 Cocoa 或 Cocoa Touch 中的 Foundation 框架进行工作,整个 NSString API 都可以调用您创建的任意 String 类型的值,您额外还可以在任意 API 中使用本章介绍的 <strong>String</strong> 特性。
|
||||||
|
您也可以在任意要求传入NSString 实例作为参数的 API 中使用 <strong>String</strong> 类型的值进行替换。</p>
|
||||||
<p>更多关于在 Foundation 和 Cocoa 中使用 <strong>String</strong> 的信息请查看 <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/index.html#//apple_ref/doc/uid/TP40014216" target="_blank">Using Swift with Cocoa and Objective-C</a>。</p>
|
<p>更多关于在 Foundation 和 Cocoa 中使用 <strong>String</strong> 的信息请查看 <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/index.html#//apple_ref/doc/uid/TP40014216" target="_blank">Using Swift with Cocoa and Objective-C</a>。</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<h3 id="-">字符串字面量</h3>
|
<h3 id="-">字符串字面量</h3>
|
||||||
<p>您可以在您的代码中包含一段预定义的字符串值作为字符串字面量。字符串字面量是由双引号包裹着的具有固定顺序的文本字符集。</p>
|
<p>您可以在您的代码中包含一段预定义的字符串值作为字符串字面量。
|
||||||
|
字符串字面量是由双引号包裹着的具有固定顺序的文本字符集。</p>
|
||||||
<p>字符串字面量可以用于为常量和变量提供初始值。</p>
|
<p>字符串字面量可以用于为常量和变量提供初始值。</p>
|
||||||
<pre><code>let someString = "Some string literal value"
|
<pre><code>let someString = "Some string literal value"
|
||||||
</code></pre><blockquote>
|
</code></pre><blockquote>
|
||||||
@ -611,7 +619,8 @@ let dollarSign = "\x24" // $, Unicode scalar U+0024
|
|||||||
let blackHeart = "\u2665" // ♥, Unicode scalar U+2665
|
let blackHeart = "\u2665" // ♥, Unicode scalar U+2665
|
||||||
let sparklingHeart = "\U0001F496" // 💖, Unicode scalar U+1F496
|
let sparklingHeart = "\U0001F496" // 💖, Unicode scalar U+1F496
|
||||||
</code></pre><h3 id="-">初始化空字符串</h3>
|
</code></pre><h3 id="-">初始化空字符串</h3>
|
||||||
<p>为了构造一个很长的字符串,可以创建一个空字符串作为初始值。可以将空的字符串字面量赋值给变量,也可以初始化一个新的 <strong>String</strong> 实例:</p>
|
<p>为了构造一个很长的字符串,可以创建一个空字符串作为初始值。
|
||||||
|
可以将空的字符串字面量赋值给变量,也可以初始化一个新的 <strong>String</strong> 实例:</p>
|
||||||
<pre><code>var emptyString = "" // empty string literal
|
<pre><code>var emptyString = "" // empty string literal
|
||||||
var anotherEmptyString = String() // initializer syntax
|
var anotherEmptyString = String() // initializer syntax
|
||||||
// 这两个字符串都为空,并且两者等价
|
// 这两个字符串都为空,并且两者等价
|
||||||
@ -633,15 +642,21 @@ constantString += " and another Highlander"
|
|||||||
<p>在 Objective-C 和 Cocoa 中,您通过选择两个不同的类( NSString 和 NSMutableString )来指定该字符串是否可以被修改,Swift中的字符串是否可以修改仅通过定义的是变量还是常量来决定,实现了多种类型可变性操作的统一。</p>
|
<p>在 Objective-C 和 Cocoa 中,您通过选择两个不同的类( NSString 和 NSMutableString )来指定该字符串是否可以被修改,Swift中的字符串是否可以修改仅通过定义的是变量还是常量来决定,实现了多种类型可变性操作的统一。</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<h3 id="-">字符串是值类型</h3>
|
<h3 id="-">字符串是值类型</h3>
|
||||||
<p>Swift 的 <strong>String</strong> 类型是值类型。如果您创建了一个新的字符串,那么当其进行常量、变量赋值操作或在函数/方法中传递时,会进行值拷贝。任何情况下,都会对已有字符串值创建新副本,并对该新副本进行传递或赋值。值类型在 <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/ClassesAndStructures.html#//apple_ref/doc/uid/TP40014097-CH13-XID_104" target="_blank">Structures and Enumerations Are Value Types</a> 中进行了说明。</p>
|
<p>Swift 的 <strong>String</strong> 类型是值类型。
|
||||||
|
如果您创建了一个新的字符串,那么当其进行常量、变量赋值操作或在函数/方法中传递时,会进行值拷贝。
|
||||||
|
任何情况下,都会对已有字符串值创建新副本,并对该新副本进行传递或赋值。
|
||||||
|
值类型在 <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/ClassesAndStructures.html#//apple_ref/doc/uid/TP40014097-CH13-XID_104" target="_blank">Structures and Enumerations Are Value Types</a> 中进行了说明。</p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p>注意:</p>
|
<p>注意:</p>
|
||||||
<p>与 Cocoa 中的 NSString 不同,当您在 Cocoa 中创建了一个 NSString 实例,并将其传递给一个函数/方法,或者赋值给一个变量,您永远都是传递或赋值同一个 NSString 实例的一个引用。除非您特别要求其进行值拷贝,否则字符串不会进行赋值新副本操作。</p>
|
<p>与 Cocoa 中的 NSString 不同,当您在 Cocoa 中创建了一个 NSString 实例,并将其传递给一个函数/方法,或者赋值给一个变量,您永远都是传递或赋值同一个 NSString 实例的一个引用,除非您特别要求其进行值拷贝,否则字符串不会进行赋值新副本操作。</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<p>Swift 默认字符串拷贝的方式保证了在函数/方法中传递的是字符串的值,其明确了无论该值来自于哪里,都是您独自拥有的。您可以放心您传递的字符串本身不会被更改。</p>
|
<p>Swift 默认字符串拷贝的方式保证了在函数/方法中传递的是字符串的值,其明确了无论该值来自于哪里,都是您独自拥有的。
|
||||||
|
您可以放心您传递的字符串本身不会被更改。</p>
|
||||||
<p>在实际编译时,Swift编译器会优化字符串的使用,使实际的复制只发生在绝对必要的情况下,这意味着您始终可以将字符串作为值类型的同时获得极高的性能。</p>
|
<p>在实际编译时,Swift编译器会优化字符串的使用,使实际的复制只发生在绝对必要的情况下,这意味着您始终可以将字符串作为值类型的同时获得极高的性能。</p>
|
||||||
<h4 id="-characters-">使用字符(Characters)</h4>
|
<h4 id="-characters-">使用字符(Characters)</h4>
|
||||||
<p>Swift 的 <strong>String</strong> 类型表示特定序列的字符值的集合。每一个字符值代表一个 Unicode 字符。您可利用 for-in 循环来遍历字符串中的每一个字符:</p>
|
<p>Swift 的 <strong>String</strong> 类型表示特定序列的字符值的集合。
|
||||||
|
每一个字符值代表一个 Unicode 字符。
|
||||||
|
您可利用 for-in 循环来遍历字符串中的每一个字符:</p>
|
||||||
<pre><code>for character in "Dog!🐶" {
|
<pre><code>for character in "Dog!🐶" {
|
||||||
println(character)
|
println(character)
|
||||||
}
|
}
|
||||||
@ -660,8 +675,13 @@ println("unusualMenagerie has \(countElements(unusualMenagerie)) characters
|
|||||||
// prints "unusualMenagerie has 40 characters"
|
// prints "unusualMenagerie has 40 characters"
|
||||||
</code></pre><blockquote>
|
</code></pre><blockquote>
|
||||||
<p>注意:</p>
|
<p>注意:</p>
|
||||||
<p>不同的 Unicode 字符以及相同 Unicode 字符的不同表示方式可能需要不同数量的内存空间来存储,所以Swift 中的字符在一个字符串中并不一定占用相同的内存空间。因此,字符串的长度不得不通过迭代字符串中每一个字符的长度来进行计算。如果您正在处理一个长字符串,需要注意 <code>countElements</code> 函数必须遍历字符串中的字符以精准计算字符串的长度。</p>
|
<p>不同的 Unicode 字符以及相同 Unicode 字符的不同表示方式可能需要不同数量的内存空间来存储。
|
||||||
<p>另外需要注意的是通过 <code>countElements</code> 返回的字符数量并不总是与包含相同字符的 NSString 的 <code>length</code> 属性相同。NSString 的 <code>length</code> 属性是基于利用 UTF-16 表示的十六位代码单元数字,而不是基于 Unicode 字符。为了解决这个问题,NSString 的 <code>length</code> 属性在被 Swift的 <strong>String</strong> 访问时会成为 <code>utf16count</code>。</p>
|
所以Swift 中的字符在一个字符串中并不一定占用相同的内存空间。
|
||||||
|
因此字符串的长度不得不通过迭代字符串中每一个字符的长度来进行计算。
|
||||||
|
如果您正在处理一个长字符串,需要注意 <code>countElements</code> 函数必须遍历字符串中的字符以精准计算字符串的长度。</p>
|
||||||
|
<p>另外需要注意的是通过 <code>countElements</code> 返回的字符数量并不总是与包含相同字符的 NSString 的 <code>length</code> 属性相同。
|
||||||
|
NSString 的 <code>length</code> 属性是基于利用 UTF-16 表示的十六位代码单元数字,而不是基于 Unicode 字符。
|
||||||
|
为了解决这个问题,NSString 的 <code>length</code> 属性在被 Swift的 <strong>String</strong> 访问时会成为 <code>utf16count</code>。</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<h3 id="-">连接字符串和字符</h3>
|
<h3 id="-">连接字符串和字符</h3>
|
||||||
<p>字符串和字符的值可以通过加法运算符 (+) 相加在一起并创建一个新的字符串值:</p>
|
<p>字符串和字符的值可以通过加法运算符 (+) 相加在一起并创建一个新的字符串值:</p>
|
||||||
@ -687,12 +707,16 @@ welcome += character1
|
|||||||
<p>您不能将一个字符串或者字符添加到一个已经存在的字符变量上,因为字符变量只能包含一个字符。</p>
|
<p>您不能将一个字符串或者字符添加到一个已经存在的字符变量上,因为字符变量只能包含一个字符。</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<h3 id="-">字符串插值</h3>
|
<h3 id="-">字符串插值</h3>
|
||||||
<p>字符串插值是一种全新的构建字符串的方式,可以在其中包含常量、变量、字面量和表达式。您插入的字符串字面量的每一项都被包裹在以反斜线为前缀的圆括号中:</p>
|
<p>字符串插值是一种全新的构建字符串的方式,可以在其中包含常量、变量、字面量和表达式。
|
||||||
|
您插入的字符串字面量的每一项都被包裹在以反斜线为前缀的圆括号中:</p>
|
||||||
<pre><code>let multiplier = 3
|
<pre><code>let multiplier = 3
|
||||||
let message = "\(multiplier) times 2.5 is \(Double(multiplier) * 2.5)"
|
let message = "\(multiplier) times 2.5 is \(Double(multiplier) * 2.5)"
|
||||||
// message is "3 times 2.5 is 7.5"
|
// message is "3 times 2.5 is 7.5"
|
||||||
</code></pre><p>在上面的例子中,<code>multiplier</code> 作为 <code>\(multiplier)</code> 被插入到一个字符串字面量中。当创建字符串执行插值计算时此占位符会被替换为 <code>multiplier</code> 实际的值。</p>
|
</code></pre><p>在上面的例子中,<code>multiplier</code> 作为 <code>\(multiplier)</code> 被插入到一个字符串字面量中。
|
||||||
<p><code>multiplier</code> 的值也作为字符串中后面表达式的一部分。该表达式计算 <code>Double(multiplier) * 2.5</code> 的值并将结果 (7.5) 插入到字符串中。在这个例子中,表达式写为 <code>\(Double(multiplier) * 2.5)</code> 并包含在字符串字面量中。</p>
|
当创建字符串执行插值计算时此占位符会被替换为 <code>multiplier</code> 实际的值。</p>
|
||||||
|
<p><code>multiplier</code> 的值也作为字符串中后面表达式的一部分。
|
||||||
|
该表达式计算 <code>Double(multiplier) * 2.5</code> 的值并将结果 (7.5) 插入到字符串中。
|
||||||
|
在这个例子中,表达式写为 <code>\(Double(multiplier) * 2.5)</code> 并包含在字符串字面量中。</p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p>注意:</p>
|
<p>注意:</p>
|
||||||
<p>您插值字符串中写在括号中的表达式不能包含非转义双引号 (") 和反斜杠 (\),并且不能包含回车或换行符。</p>
|
<p>您插值字符串中写在括号中的表达式不能包含非转义双引号 (") 和反斜杠 (\),并且不能包含回车或换行符。</p>
|
||||||
@ -708,7 +732,9 @@ if quotation == sameQuotation {
|
|||||||
}
|
}
|
||||||
// prints "These two strings are considered equal"
|
// prints "These two strings are considered equal"
|
||||||
</code></pre><h5 id="-">前缀/后缀相等</h5>
|
</code></pre><h5 id="-">前缀/后缀相等</h5>
|
||||||
<p>通过调用字符串的 <code>hasPrefix</code>/<code>hasSuffix</code> 方法来检查字符串是否拥有特定前缀/后缀。两个方法均需要以字符串作为参数传入并传出 <strong>Boolean</strong> 值。两个方法均执行基本字符串和前缀/后缀字符串之间逐个字符的比较操作。</p>
|
<p>通过调用字符串的 <code>hasPrefix</code>/<code>hasSuffix</code> 方法来检查字符串是否拥有特定前缀/后缀。
|
||||||
|
两个方法均需要以字符串作为参数传入并传出 <strong>Boolean</strong> 值。
|
||||||
|
两个方法均执行基本字符串和前缀/后缀字符串之间逐个字符的比较操作。</p>
|
||||||
<p>下面的例子以一个字符串数组表示莎士比亚话剧 <code>罗密欧与朱丽叶</code> 中前两场的场景位置:</p>
|
<p>下面的例子以一个字符串数组表示莎士比亚话剧 <code>罗密欧与朱丽叶</code> 中前两场的场景位置:</p>
|
||||||
<pre><code>let romeoAndJuliet = [
|
<pre><code>let romeoAndJuliet = [
|
||||||
"Act 1 Scene 1: Verona, A public place",
|
"Act 1 Scene 1: Verona, A public place",
|
||||||
@ -740,14 +766,17 @@ let shouty = normal.uppercaseString
|
|||||||
let whispered = normal.lowercaseString
|
let whispered = normal.lowercaseString
|
||||||
// whispered 值为 "could you help me, please?"
|
// whispered 值为 "could you help me, please?"
|
||||||
</code></pre><h3 id="unicode">Unicode</h3>
|
</code></pre><h3 id="unicode">Unicode</h3>
|
||||||
<p>Unicode 是文本编码和表示的国际标准。它使您可以用标准格式表示来自任意语言几乎所有的字符,并能够对文本文件或网页这样的外部资源中的字符进行读写操作。</p>
|
<p>Unicode 是文本编码和表示的国际标准。
|
||||||
|
它使您可以用标准格式表示来自任意语言几乎所有的字符,并能够对文本文件或网页这样的外部资源中的字符进行读写操作。</p>
|
||||||
<p>Swift 的字符串和字符类型是完全兼容 Unicode 的,它支持如下所述的一系列不同的 Unicode 编码。</p>
|
<p>Swift 的字符串和字符类型是完全兼容 Unicode 的,它支持如下所述的一系列不同的 Unicode 编码。</p>
|
||||||
<h6 id="unicode-terminology-">Unicode 术语(Terminology)</h6>
|
<h6 id="unicode-terminology-">Unicode 术语(Terminology)</h6>
|
||||||
<p>Unicode 中每一个字符都可以被解释为一个或多个 unicode 标量。字符的 unicode 标量是一个唯一的21位数字(和名称),例如 <code>U+0061</code> 表示小写的拉丁字母A ("a"),<code>U+1F425</code> 表示 ("🐥")</p>
|
<p>Unicode 中每一个字符都可以被解释为一个或多个 unicode 标量。
|
||||||
|
字符的 unicode 标量是一个唯一的21位数字(和名称),例如 <code>U+0061</code> 表示小写的拉丁字母A ("a"),<code>U+1F425</code> 表示小幺鸡表情 ("🐥")</p>
|
||||||
<p>当 Unicode 字符串被写进文本文件或其他存储结构当中,这些 unicode 标量将会按照 Unicode 定义的集中格式之一进行编码。其包括 <code>UTF-8</code> (以8位代码单元进行编码) 和 <code>UTF-16</code> (以16位代码单元进行编码)。</p>
|
<p>当 Unicode 字符串被写进文本文件或其他存储结构当中,这些 unicode 标量将会按照 Unicode 定义的集中格式之一进行编码。其包括 <code>UTF-8</code> (以8位代码单元进行编码) 和 <code>UTF-16</code> (以16位代码单元进行编码)。</p>
|
||||||
<h5 id="-unicode-">字符串的 Unicode 表示</h5>
|
<h5 id="-unicode-">字符串的 Unicode 表示</h5>
|
||||||
<p>Swift 提供了几种不同的方式来访问字符串的 Unicode 表示。</p>
|
<p>Swift 提供了几种不同的方式来访问字符串的 Unicode 表示。</p>
|
||||||
<p>您可以利用 <code>for-in</code> 来对字符串进行遍历,从而以 Unicode 字符的方式访问每一个字符值。该过程在 <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-XID_376" target="_blank">Working with Characters</a> 中进行了描述。</p>
|
<p>您可以利用 <code>for-in</code> 来对字符串进行遍历,从而以 Unicode 字符的方式访问每一个字符值。
|
||||||
|
该过程在 <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-XID_376" target="_blank">Working with Characters</a> 中进行了描述。</p>
|
||||||
<p>另外,能够以其他三种 Unicode 兼容的方式访问字符串的值:</p>
|
<p>另外,能够以其他三种 Unicode 兼容的方式访问字符串的值:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>UTF-8 代码单元集合 (利用字符串的 <code>utf8</code> 属性进行访问)</li>
|
<li>UTF-8 代码单元集合 (利用字符串的 <code>utf8</code> 属性进行访问)</li>
|
||||||
@ -757,31 +786,39 @@ let whispered = normal.lowercaseString
|
|||||||
<p>下面由 <code>D</code> <code>o</code> <code>g</code> <code>!</code> 和 <code>🐶</code> (狗脸表情,Unicode 标量为 <code>U+1F436</code>)组成的字符串中的每一个字符代表着一种不同的表示:</p>
|
<p>下面由 <code>D</code> <code>o</code> <code>g</code> <code>!</code> 和 <code>🐶</code> (狗脸表情,Unicode 标量为 <code>U+1F436</code>)组成的字符串中的每一个字符代表着一种不同的表示:</p>
|
||||||
<pre><code>let dogString = "Dog!🐶"
|
<pre><code>let dogString = "Dog!🐶"
|
||||||
</code></pre><h5 id="utf-8">UTF-8</h5>
|
</code></pre><h5 id="utf-8">UTF-8</h5>
|
||||||
<p>您可以通过遍历字符串的 <code>utf8</code> 属性来访问它的 <code>UTF-8</code> 表示。其为 <strong>UTF8View</strong> 类型的属性,<strong>UTF8View</strong> 是无符号8位 (<code>UInt8</code>) 值的集合,每一个 <code>UIn8</code> 都是一个字符的 UTF-8 表示:</p>
|
<p>您可以通过遍历字符串的 <code>utf8</code> 属性来访问它的 <code>UTF-8</code> 表示。
|
||||||
|
其为 <strong>UTF8View</strong> 类型的属性,<strong>UTF8View</strong> 是无符号8位 (<code>UInt8</code>) 值的集合,每一个 <code>UIn8</code> 都是一个字符的 UTF-8 表示:</p>
|
||||||
<pre><code>for codeUnit in dogString.utf8 {
|
<pre><code>for codeUnit in dogString.utf8 {
|
||||||
print("\(codeUnit) ")
|
print("\(codeUnit) ")
|
||||||
}
|
}
|
||||||
print("\n")
|
print("\n")
|
||||||
// 68 111 103 33 240 159 144 182
|
// 68 111 103 33 240 159 144 182
|
||||||
</code></pre><p>上面的例子中,前四个10进制代码单元值 (68, 111, 103, 33) 代表了字符 <code>D</code> <code>o</code> <code>g</code> 和 <code>!</code> ,他们的 UTF-8 表示与 ASCII 表示相同。后四个代码单元值 (240, 159, 144, 182) 是 <code>狗脸表情</code> 的4位 UTF-8 表示。</p>
|
</code></pre><p>上面的例子中,前四个10进制代码单元值 (68, 111, 103, 33) 代表了字符 <code>D</code> <code>o</code> <code>g</code> 和 <code>!</code> ,他们的 UTF-8 表示与 ASCII 表示相同。
|
||||||
|
后四个代码单元值 (240, 159, 144, 182) 是 <code>狗脸表情</code> 的4位 UTF-8 表示。</p>
|
||||||
<h5 id="utf-16">UTF-16</h5>
|
<h5 id="utf-16">UTF-16</h5>
|
||||||
<p>您可以通过遍历字符串的 <code>utf16</code> 属性来访问它的 <code>UTF-16</code> 表示。其为 <strong>UTF16View</strong> 类型的属性,<strong>UTF16View</strong> 是无符号16位 (<code>UInt16</code>) 值的集合,每一个 <code>UInt16</code> 都是一个字符的 UTF-16 表示:</p>
|
<p>您可以通过遍历字符串的 <code>utf16</code> 属性来访问它的 <code>UTF-16</code> 表示。
|
||||||
|
其为 <strong>UTF16View</strong> 类型的属性,<strong>UTF16View</strong> 是无符号16位 (<code>UInt16</code>) 值的集合,每一个 <code>UInt16</code> 都是一个字符的 UTF-16 表示:</p>
|
||||||
<pre><code>for codeUnit in dogString.utf16 {
|
<pre><code>for codeUnit in dogString.utf16 {
|
||||||
print("\(codeUnit) ")
|
print("\(codeUnit) ")
|
||||||
}
|
}
|
||||||
print("\n")
|
print("\n")
|
||||||
// 68 111 103 33 55357 56374
|
// 68 111 103 33 55357 56374
|
||||||
</code></pre><p>同样,前四个代码单元值 (68, 111, 103, 33) 代表了字符 <code>D</code> <code>o</code> <code>g</code> 和 <code>!</code> ,他们的 UTF-16 代码单元和 UTF-8 完全相同。</p>
|
</code></pre><p>同样,前四个代码单元值 (68, 111, 103, 33) 代表了字符 <code>D</code> <code>o</code> <code>g</code> 和 <code>!</code> ,他们的 UTF-16 代码单元和 UTF-8 完全相同。</p>
|
||||||
<p>第五和第六个代码单元值 (55357 and 56374) 是 <code>狗脸表情</code> 字符的UTF-16 表示。第一个值为 <code>U+D83D</code> (十进制值为 55357),第二个值为 <code>U+DC36</code> (十进制值为 56374)。</p>
|
<p>第五和第六个代码单元值 (55357 and 56374) 是 <code>狗脸表情</code> 字符的UTF-16 表示。
|
||||||
|
第一个值为 <code>U+D83D</code> (十进制值为 55357),第二个值为 <code>U+DC36</code> (十进制值为 56374)。</p>
|
||||||
<h5 id="unicode-scalars-">Unicode 标量 (Scalars)</h5>
|
<h5 id="unicode-scalars-">Unicode 标量 (Scalars)</h5>
|
||||||
<p>您可以通过遍历字符串的 <code>unicodeScalars</code> 属性来访问它的 Unicode 标量表示。其为 <strong>UnicodeScalarView</strong> 类型的属性, <strong>UnicodeScalarView</strong> 是 <code>UnicodeScalar</code> 的集合。<code>UnicodeScalar</code> 是21位的 Unicode 代码点。</p>
|
<p>您可以通过遍历字符串的 <code>unicodeScalars</code> 属性来访问它的 Unicode 标量表示。
|
||||||
|
其为 <strong>UnicodeScalarView</strong> 类型的属性, <strong>UnicodeScalarView</strong> 是 <code>UnicodeScalar</code> 的集合。
|
||||||
|
<code>UnicodeScalar</code> 是21位的 Unicode 代码点。</p>
|
||||||
<p>每一个 <code>UnicodeScalar</code> 拥有一个值属性,可以返回对应的21位数值,用 <code>UInt32</code> 来表示。</p>
|
<p>每一个 <code>UnicodeScalar</code> 拥有一个值属性,可以返回对应的21位数值,用 <code>UInt32</code> 来表示。</p>
|
||||||
<pre><code>for scalar in dogString.unicodeScalars {
|
<pre><code>for scalar in dogString.unicodeScalars {
|
||||||
print("\(scalar.value) ")
|
print("\(scalar.value) ")
|
||||||
}
|
}
|
||||||
print("\n")
|
print("\n")
|
||||||
// 68 111 103 33 128054
|
// 68 111 103 33 128054
|
||||||
</code></pre><p>同样,前四个代码单元值 (68, 111, 103, 33) 代表了字符 <code>D</code> <code>o</code> <code>g</code> 和 <code>!</code> 。第五位数值,128054,是一个十六进制1F436的十进制表示。其等同于 <code>狗脸表情</code> 的Unicode 标量 U+1F436。</p>
|
</code></pre><p>同样,前四个代码单元值 (68, 111, 103, 33) 代表了字符 <code>D</code> <code>o</code> <code>g</code> 和 <code>!</code> 。
|
||||||
|
第五位数值,128054,是一个十六进制1F436的十进制表示。
|
||||||
|
其等同于 <code>狗脸表情</code> 的Unicode 标量 U+1F436。</p>
|
||||||
<p>作为查询字符值属性的一种替代方法,每个 <code>UnicodeScalar</code> 值也可以用来构建一个新的字符串值,比如在字符串插值中使用:</p>
|
<p>作为查询字符值属性的一种替代方法,每个 <code>UnicodeScalar</code> 值也可以用来构建一个新的字符串值,比如在字符串插值中使用:</p>
|
||||||
<pre><code>for scalar in dogString.unicodeScalars {
|
<pre><code>for scalar in dogString.unicodeScalars {
|
||||||
println("\(scalar) ")
|
println("\(scalar) ")
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.4" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.4" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.5" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.5" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.6" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.6" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,7 +576,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_12">
|
<section class="normal" id="section-gitbook_14">
|
||||||
|
|
||||||
<h1 id="-functions-">函数(Functions)</h1>
|
<h1 id="-functions-">函数(Functions)</h1>
|
||||||
<p>函数是用来完成特定任务的独立的代码块。你给一个函数起一个合适的名字,用来标示函数做什么,并且当函数需要执行的时候,这个名字会被“调用”。</p>
|
<p>函数是用来完成特定任务的独立的代码块。你给一个函数起一个合适的名字,用来标示函数做什么,并且当函数需要执行的时候,这个名字会被“调用”。</p>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.7" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.7" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,6 +576,243 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
|
<section class="normal" id="section-gitbook_15">
|
||||||
|
|
||||||
|
<h1 id="-">闭包</h1>
|
||||||
|
<p>闭包是功能性自包含模块,可以在代码中被传递和使用。
|
||||||
|
Swift 中的闭包与 C 和 Objective-C 中的 <code>blocks</code> 以及其他一些编程语言中的 <code>lambdas</code> 比较相似。</p>
|
||||||
|
<p>闭包可以 <strong>捕获</strong> 和存储其所在上下文中任意常量和变量的引用。
|
||||||
|
这就是所谓的闭合并包裹着这些常量和变量,俗称闭包。Swift 会为您管理在 <strong>捕获</strong> 过程中涉及到的内存操作。</p>
|
||||||
|
<blockquote>
|
||||||
|
<p>注意:</p>
|
||||||
|
<p>如果您不熟悉 <strong>捕获</strong> (capturing) 这个概念也不用担心,后面会详细对其进行介绍。</p>
|
||||||
|
</blockquote>
|
||||||
|
<p>在 <code>函数</code> 章节中介绍的全局和嵌套函数实际上也是特殊的闭包,闭包采取如下三种形式之一:</p>
|
||||||
|
<ul>
|
||||||
|
<li>全局函数是一个有名字但不会捕获任何值的闭包</li>
|
||||||
|
<li>嵌套函数是一个有名字并可以捕获其封闭函数域内值的闭包</li>
|
||||||
|
<li>闭包表达式是一个利用轻量级语法所写的可以捕获其上下文中变量或常量值的没有名字的闭包</li>
|
||||||
|
</ul>
|
||||||
|
<p>Swift 的闭包表达式拥有简洁的风格,并鼓励在常见场景中进行语法优化,主要优化如下:</p>
|
||||||
|
<ul>
|
||||||
|
<li>利用上下文推断参数和返回值类型</li>
|
||||||
|
<li>单表达式闭包可以省略 <code>return</code> 关键字</li>
|
||||||
|
<li>参数名称缩写</li>
|
||||||
|
<li>Trailing 闭包语法</li>
|
||||||
|
</ul>
|
||||||
|
<h3 id="-">闭包表达式</h3>
|
||||||
|
<p>嵌套函数是一个在较复杂函数中方便进行命名和定义自包含代码模块的方式。
|
||||||
|
当然,有时候撰写小巧的没有完整定义和命名的类函数结构也是很有用处的,尤其是在您处理一些函数并需要将另外一些函数作为该函数的参数时。</p>
|
||||||
|
<p>闭包表达式是一种利用简洁语法构建内联闭包的方式。
|
||||||
|
闭包表达式提供了一些语法优化,使得撰写闭包变得简单明了。
|
||||||
|
下面闭包表达式的例子通过使用几次迭代展示了 <code>sort</code> 函数定义和语法优化的方式。
|
||||||
|
每一次迭代都用更简洁的方式描述了相同的功能。</p>
|
||||||
|
<h5 id="-sort-"><code>sort</code> 函数</h5>
|
||||||
|
<p>Swift 标准库提供了 <code>sort</code> 函数,会根据您提供的排序闭包将已知类型数组中的值进行排序。
|
||||||
|
一旦排序完成,函数会返回一个与原数组大小相同的新数组,该数组中包含已经正确排序的同类型元素。</p>
|
||||||
|
<p>下面的闭包表达式示例使用 <code>sort</code> 函数对一个 <strong>String</strong> 类型的数组进行字母逆序排序,以下是初始数组值:</p>
|
||||||
|
<pre><code>let names = ["Chris", "Alex", "Ewa", "Barry", "Daniella"]
|
||||||
|
</code></pre><p>该例子对一个 <strong>String</strong> 类型的数组进行排序,因此排序闭包需为 <code>(String, String) -> Bool</code> 类型的函数。</p>
|
||||||
|
<p>提供排序闭包的一种方式是撰写一个符合其类型要求的普通函数,并将其作为 <code>sort</code> 函数的第二个参数传入:</p>
|
||||||
|
<pre><code>func backwards(s1: String, s2: String) -> Bool {
|
||||||
|
return s1 > s2
|
||||||
|
}
|
||||||
|
var reversed = sort(names, backwards)
|
||||||
|
// reversed is equal to ["Ewa", "Daniella", "Chris", "Barry", "Alex"]
|
||||||
|
</code></pre><p>如果第一个字符串 (s1) 大于第二个字符串 (s2),<code>backwards</code> 函数则返回 <code>true</code>,表示在新的数组中 s1 应该出现在 s2 前。
|
||||||
|
字符中的 "大于" 表示 "按照字母顺序后出现"。
|
||||||
|
这意味着字母 "B" 大于字母 "A", 字符串 "Tom" 大于字符串 "Tim"。
|
||||||
|
其将进行字母逆序排序,"Barry" 将会排在 "Alex" 之后。</p>
|
||||||
|
<p>然而,这是一个相当冗长的方式,本质上只是写了一个单表达式函数 (a > b)。
|
||||||
|
在下面的例子中,利用闭合表达式语法可以更好的构造一个内联排序闭包。</p>
|
||||||
|
<h5 id="-">闭包表达式语法</h5>
|
||||||
|
<p>闭包表达式语法有如下一般形式:</p>
|
||||||
|
<pre><code>{ (parameters) -> returnType in
|
||||||
|
statements
|
||||||
|
}
|
||||||
|
</code></pre><p>闭包表达式语法可以使用常量、变量和 <code>inout</code> 类型作为参数,不提供默认值。
|
||||||
|
也可以在参数列表的最后使用可变参数。元组也可以作为参数和返回值。</p>
|
||||||
|
<p>下面的例子展示了之前 <code>backwards</code> 函数对应的闭包表达式版本的代码:</p>
|
||||||
|
<pre><code>reversed = sort(names, { (s1: String, s2: String) -> Bool in
|
||||||
|
return s1 > s2
|
||||||
|
})
|
||||||
|
</code></pre><p>需要注意的是内联闭包参数和返回值类型声明与 <code>backwards</code> 函数类型声明相同。
|
||||||
|
在这两种方式中,都写成了 (s1: String, s2: String) -> Bool。
|
||||||
|
然而在内联闭包表达式中,函数和返回值类型都写在大括号内,而不是大括号外。</p>
|
||||||
|
<p>闭包的函数体部分由关键字 <code>in</code> 引入。
|
||||||
|
该关键字表示闭包的参数和返回值类型定义已经完成,闭包函数体即将开始。</p>
|
||||||
|
<p>因为这个闭包的函数体部分如此短以至于可以将其改写成一行代码:</p>
|
||||||
|
<pre><code>reversed = sort(names, { (s1: String, s2: String) -> Bool in return s1 > s2 } )
|
||||||
|
</code></pre><p>这说明 <code>sort</code> 函数的整体调用保持不变,一对圆括号仍然包裹住了函数中整个参数集合。而其中一个参数现在变成了内联闭包 (相比于 <code>backwards</code> 版本的代码)。</p>
|
||||||
|
<h5 id="-">根据上下文推断类型</h5>
|
||||||
|
<p>因为排序闭包是作为函数的参数进行传入的,Swift可以推断其参数和返回值的类型。
|
||||||
|
<code>sort</code> 期望第二个参数是类型为 <code>(String, String) -> Bool</code> 的函数,因此实际上 <code>String</code>, <code>String</code> 和 <code>Bool</code> 类型并不需要作为闭包表达式定义中的一部分。
|
||||||
|
因为所有的类型都可以被正确推断,返回箭头 (->) 和 围绕在参数周围的括号也可以被省略:</p>
|
||||||
|
<pre><code>reversed = sort(names, { s1, s2 in return s1 > s2 } )
|
||||||
|
</code></pre><p>实际上任何情况下,通过内联闭包表达式构造的闭包作为参数传递给函数时,都可以推断出闭包的参数和返回值类型,这意味着您几乎不需要利用完整格式构造任何内联闭包。</p>
|
||||||
|
<h5 id="-return-">单行表达式闭包可以省略 <code>return</code></h5>
|
||||||
|
<p>单行表达式闭包可以通过隐藏 <code>return</code> 关键字来隐式返回单行表达式的结果,如上版本的例子可以改写为:</p>
|
||||||
|
<pre><code>reversed = sort(names, { s1, s2 in s1 > s2 } )
|
||||||
|
</code></pre><p>在这个例子中,<code>sort</code> 函数的第二个参数函数类型明确了闭包必须返回一个 <strong>Bool</strong> 类型值。
|
||||||
|
因为闭包函数体只包含了一个单一表达式 (s1 > s2),该表达式返回 <strong>Bool</strong> 类型值,因此这里没有歧义,<code>return</code>关键字可以省略。</p>
|
||||||
|
<h5 id="-">参数名称缩写</h5>
|
||||||
|
<p>Swift 自动为内联函数提供了参数名称缩写功能,您可以直接通过 <code>$0</code>,<code>$1</code>,<code>$2</code> 来顺序调用闭包的参数。</p>
|
||||||
|
<p>如果您在闭包表达式中使用参数名称缩写,您可以在闭包参数列表中省略对其的定义,并且对应参数名称缩写的类型会通过函数类型进行推断。
|
||||||
|
<code>in</code> 关键字也同样可以被省略,因为此时闭包表达式完全由闭包函数体构成:</p>
|
||||||
|
<pre><code>reversed = sort(names, { $0 > $1 } )
|
||||||
|
</code></pre><p>在这个例子中,<code>$0</code> 和 <code>$1</code> 表示闭包中第一个和第二个 <strong>String</strong> 类型的参数。</p>
|
||||||
|
<h5 id="-">运算符函数</h5>
|
||||||
|
<p>实际上还有一种更简短的方式来撰写上面例子中的闭包表达式。
|
||||||
|
Swift 的 <strong>String</strong> 类型定义了关于大于号 (>) 的字符串实现,其作为一个函数接受两个 <strong>String</strong> 类型的参数并返回 <strong>Bool</strong> 类型的值。
|
||||||
|
而这正好与 <code>sort</code> 函数的第二个参数需要的函数类型相符合。
|
||||||
|
因此,您可以简单地传递一个大于号,Swift可以自动推断出您想使用大于号的字符串函数实现:</p>
|
||||||
|
<pre><code>reversed = sort(names, >)
|
||||||
|
</code></pre><p>更多关于运算符表达式的内容请查看 <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-XID_43" target="_blank">Operator Functions</a> 。</p>
|
||||||
|
<h3 id="trailing-">Trailing 闭包</h3>
|
||||||
|
<p>如果您需要将一个很长的闭包表达式作为最后一个参数传递给函数,可以使用 trailing 闭包来增强函数的可读性。
|
||||||
|
Trailing 闭包是一个书写在函数括号之外(之后)的闭包表达式,函数支持将其作为最后一个参数调用。</p>
|
||||||
|
<pre><code>func someFunctionThatTakesAClosure(closure: () -> ()) {
|
||||||
|
// 函数体部分
|
||||||
|
}
|
||||||
|
|
||||||
|
// 以下是不使用 trailing 闭包进行函数调用
|
||||||
|
|
||||||
|
someFunctionThatTakesAClosure({
|
||||||
|
// 闭包主体部分
|
||||||
|
})
|
||||||
|
|
||||||
|
// 以下是使用 trailing 闭包进行函数调用
|
||||||
|
|
||||||
|
someFunctionThatTakesAClosure() {
|
||||||
|
// 闭包主体部分
|
||||||
|
}
|
||||||
|
</code></pre><blockquote>
|
||||||
|
<p>注意:</p>
|
||||||
|
<p>如果函数只需要闭包表达式一个参数,当您使用 trailing 闭包时,您甚至可以把 () 省略掉。
|
||||||
|
NOTE</p>
|
||||||
|
</blockquote>
|
||||||
|
<p>在上例中作为 <code>sort</code> 函数参数的字符串排序闭包可以改写为:</p>
|
||||||
|
<pre><code>reversed = sort(names) { $0 > $1 }
|
||||||
|
</code></pre><p>当闭包非常长以至于不能在一行中进行书写时,Trailing 闭包变得非常有用。
|
||||||
|
举例来说,Swift 的 <strong>Array</strong> 类型有一个 <code>map</code> 方法,其获取一个闭包表达式作为其唯一参数。
|
||||||
|
数组中的每一个元素调用一次该闭包函数,并返回该元素所映射的值(也可以是不同类型的值)。
|
||||||
|
具体的映射方式和返回值类型由闭包来指定。</p>
|
||||||
|
<p>当提供给数组闭包函数后,<code>map</code> 方法将返回一个新的数组,数组中包含了与原数组一一对应的映射后的值。</p>
|
||||||
|
<p>下例介绍了如何在 <code>map</code> 方法中使用 trailing 闭包将 <strong>Int</strong> 类型数组 <code>[16,58,510]</code> 转换为包含对应 <strong>String</strong> 类型的数组 <code>["OneSix", "FiveEight", "FiveOneZero"]</code>:</p>
|
||||||
|
<pre><code>let digitNames = [
|
||||||
|
0: "Zero", 1: "One", 2: "Two", 3: "Three", 4: "Four",
|
||||||
|
5: "Five", 6: "Six", 7: "Seven", 8: "Eight", 9: "Nine"
|
||||||
|
]
|
||||||
|
let numbers = [16, 58, 510]
|
||||||
|
</code></pre><p>如上代码创建了一个数字位和他们名字映射的英文版本字典。
|
||||||
|
同时定义了一个准备转换为字符串的整型数组。</p>
|
||||||
|
<p>您现在可以通过传递一个 trailing 闭包给 <code>numbers</code> 的 <code>map</code> 方法来创建对应的字符串版本数组。
|
||||||
|
需要注意的时调用 <code>numbers.map</code> 不需要在 <code>map</code> 后面包含任何括号,因为其只需要传递闭包表达式这一个参数,并且该闭包表达式参数通过 trailing 方式进行撰写:</p>
|
||||||
|
<pre><code>let strings = numbers.map {
|
||||||
|
(var number) -> String in
|
||||||
|
var output = ""
|
||||||
|
while number > 0 {
|
||||||
|
output = digitNames[number % 10]! + output
|
||||||
|
number /= 10
|
||||||
|
}
|
||||||
|
return output
|
||||||
|
}
|
||||||
|
// strings 常量被推断为字符串类型数组,即 String[]
|
||||||
|
// 其值为 ["OneSix", "FiveEight", "FiveOneZero"]
|
||||||
|
</code></pre><p><code>map</code> 在数组中为每一个元素调用了闭包表达式。
|
||||||
|
您不需要指定闭包的输入参数 <code>number</code> 的类型,因为可以通过要映射的数组类型进行推断。</p>
|
||||||
|
<p>闭包 <code>number</code> 参数被声明为一个变量参数 (变量的具体描述请参看<a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Functions.html#//apple_ref/doc/uid/TP40014097-CH10-XID_224" target="_blank">Constant and Variable Parameters</a>),因此可以在闭包函数体内对其进行修改。
|
||||||
|
闭包表达式制定了返回类型为 <strong>String</strong>,以表明存储映射值的新数组类型为 <strong>String</strong>。</p>
|
||||||
|
<p>闭包表达式在每次被调用的时候创建了一个字符串并返回。
|
||||||
|
其使用求余运算符 (number % 10) 计算最后一位数字并利用 <code>digitNames</code> 字典获取所映射的字符串。</p>
|
||||||
|
<blockquote>
|
||||||
|
<p>注意:</p>
|
||||||
|
<p>字典 <code>digitNames</code> 下标后跟着一个叹号 (!),因为字典下标返回一个可选值 (optional value),表明即使该 key 不存在也不会查找失败。
|
||||||
|
在上例中,它保证了 <code>number % 10</code> 可以总是作为一个 <code>digitNames</code> 字典的有效下标 key。
|
||||||
|
因此叹号可以用于强制展开 (force-unwrap) 存储在可选下标项中的 <strong>String</strong> 类型值。</p>
|
||||||
|
</blockquote>
|
||||||
|
<p>从 <code>digitNames</code> 字典中获取的字符串被添加到输出的前部,逆序建立了一个字符串版本的数字。
|
||||||
|
(在表达式 <code>number % 10</code>中,如果number为16,则返回6,58返回8,510返回0)。</p>
|
||||||
|
<p><code>number</code> 变量之后除以10。
|
||||||
|
因为其是整数,在计算过程中未除尽部分被忽略。
|
||||||
|
因此 16变成了1,58变成了5,510变成了51。</p>
|
||||||
|
<p>整个过程重复进行,直到 <code>number /= 10</code> 为0,这时闭包会将字符串输出,而map函数则会将字符串添加到所映射的数组中。</p>
|
||||||
|
<p>上例中 trailing 闭包语法在函数后整洁封装了具体的闭包功能,而不再需要将整个闭包包裹在 <code>map</code> 函数的括号内。</p>
|
||||||
|
<h3 id="-caputure-">捕获 (Caputure)</h3>
|
||||||
|
<p>闭包可以在其定义的上下文中捕获常量或变量。
|
||||||
|
即使定义这些常量和变量的原域已经不存在,闭包仍然可以在闭包函数体内引用和修改这些值。</p>
|
||||||
|
<p>Swift最简单的闭包形式是嵌套函数,也就是定义在其他函数的函数体内的函数。
|
||||||
|
嵌套函数可以捕获其外部函数所有的参数以及定义的常量和变量。</p>
|
||||||
|
<p>下例为一个叫做 <code>makeIncrementor</code> 的函数,其包含了一个叫做 <code>incrementor</code> 嵌套函数。
|
||||||
|
嵌套函数 <code>incrementor</code> 从上下文中捕获了两个值,<code>runningTotal</code> 和 <code>amount</code>。
|
||||||
|
之后 <code>makeIncrementor</code> 将 <code>incrementor</code> 作为闭包返回。
|
||||||
|
每次调用 <code>incrementor</code> 时,其会以 <code>amount</code> 作为增量增加 <code>runningTotal</code> 的值。</p>
|
||||||
|
<pre><code>func makeIncrementor(forIncrement amount: Int) -> () -> Int {
|
||||||
|
var runningTotal = 0
|
||||||
|
func incrementor() -> Int {
|
||||||
|
runningTotal += amount
|
||||||
|
return runningTotal
|
||||||
|
}
|
||||||
|
return incrementor
|
||||||
|
}
|
||||||
|
</code></pre><p><code>makeIncrementor</code> 返回类型为 <code>() -> Int</code>。
|
||||||
|
这意味着其返回的是一个函数,而不是一个简单类型值。
|
||||||
|
该函数在每次调用时不接受参数只返回一个 <strong>Int</strong> 类型的值。
|
||||||
|
关于函数返回其他函数的内容,请查看<a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Functions.html#//apple_ref/doc/uid/TP40014097-CH10-XID_232" target="_blank">Function Types as Return Types</a>。</p>
|
||||||
|
<p><code>makeIncrementor</code> 函数定义了一个整型变量 <code>runningTotal</code> (初始为0) 用来存储当前跑步总数。
|
||||||
|
该值通过 <code>incrementor</code> 返回。</p>
|
||||||
|
<p><code>makeIncrementor</code> 有一个 <strong>Int</strong> 类型的参数,其外部命名为 <code>forIncrement</code>, 内部命名为 <code>amount</code>,表示每次 <code>incrementor</code> 被调用时 <code>runningTotal</code> 将要增加的量。</p>
|
||||||
|
<p><code>incrementor</code> 函数用来执行实际的增加操作。
|
||||||
|
该函数简单地使 <code>runningTotal</code> 增加 <code>amount</code>,并将其返回。</p>
|
||||||
|
<p>如果我们单独看这个函数,会发现看上去不同寻常:</p>
|
||||||
|
<pre><code>func incrementor() -> Int {
|
||||||
|
runningTotal += amount
|
||||||
|
return runningTotal
|
||||||
|
}
|
||||||
|
</code></pre><p><code>incrementor</code> 函数并没有获取任何参数,但是在函数体内访问了 <code>runningTotal</code> 和 <code>amount</code> 变量。这是因为其通过捕获在包含它的函数体内已经存在的 <code>runningTotal</code> 和 <code>amount</code> 变量而实现。</p>
|
||||||
|
<p>由于没有修改 <code>amount</code> 变量,<code>incrementor</code> 实际上捕获并存储了该变量的一个副本,而该副本随着 <code>incrementor</code> 一同被存储。</p>
|
||||||
|
<p>然而,因为每次调用该函数的时候都会修改 <code>runningTotal</code> 的值,<code>incrementor</code> 捕获了当前 <code>runningTotal</code> 变量的引用,而不是仅仅复制该变量的初始值。捕获一个引用保证了当 <code>makeIncrementor</code> 结束时候并不会消失,也保证了当下一次执行 <code>incrementor</code> 函数时,<code>runningTotal</code> 可以继续增加。</p>
|
||||||
|
<blockquote>
|
||||||
|
<p>注意:</p>
|
||||||
|
<p>Swift 会决定捕获引用还是拷贝值。
|
||||||
|
您不需要标注 <code>amount</code> 或者 <code>runningTotal</code> 来声明在嵌入的 <code>incrementor</code> 函数中的使用方式。
|
||||||
|
Swift 同时也处理 <code>runingTotal</code> 变量的内存管理操作,如果不再被 <code>incrementor</code> 函数使用,则会被清除。</p>
|
||||||
|
</blockquote>
|
||||||
|
<p>下面为一个使用 <code>makeIncrementor</code> 的例子:</p>
|
||||||
|
<pre><code>let incrementByTen = makeIncrementor(forIncrement: 10)
|
||||||
|
</code></pre><p>该例子定义了一个叫做 <code>incrementByTen</code> 的常量,该常量指向一个每次调用会加10的 <code>incrementor</code> 函数。
|
||||||
|
调用这个函数多次可以得到以下结果:</p>
|
||||||
|
<pre><code>incrementByTen()
|
||||||
|
// 返回的值为10
|
||||||
|
incrementByTen()
|
||||||
|
// 返回的值为20
|
||||||
|
incrementByTen()
|
||||||
|
// 返回的值为30
|
||||||
|
</code></pre><p>如果您创建了另一个 <code>incrementor</code>,其会有一个属于自己的独立的 <code>runningTotal</code> 变量的引用。
|
||||||
|
下面的例子中,<code>incrementBySevne</code> 捕获了一个新的 <code>runningTotal</code> 变量,该变量和 <code>incrementByTen</code> 中捕获的变量没有任何联系:</p>
|
||||||
|
<pre><code>let incrementBySeven = makeIncrementor(forIncrement: 7)
|
||||||
|
incrementBySeven()
|
||||||
|
// 返回的值为7
|
||||||
|
incrementByTen()
|
||||||
|
// 返回的值为40
|
||||||
|
</code></pre><blockquote>
|
||||||
|
<p>注意:</p>
|
||||||
|
<p>如果您闭包分配给一个类实例的属性,并且该闭包通过指向该实例或其成员来捕获了该实例,您将创建一个在闭包和实例间的强引用环。
|
||||||
|
Swift 使用捕获列表来打破这种强引用环。更多信息,请参考 <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AutomaticReferenceCounting.html#//apple_ref/doc/uid/TP40014097-CH20-XID_61" target="_blank">Strong Reference Cycles for Closures</a>。</p>
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="-">闭包是引用类型</h3>
|
||||||
|
<p>上面的例子中,<code>incrementBySeven</code> 和 <code>incrementByTen</code> 是常量,但是这些常量指向的闭包仍然可以增加其捕获的变量值。
|
||||||
|
这是因为函数和闭包都是引用类型。</p>
|
||||||
|
<p>无论您将函数/闭包赋值给一个常量还是变量,您实际上都是将常量/变量的值设置为对应函数/闭包的引用。
|
||||||
|
上面的例子中,<code>incrementByTen</code> 指向闭包的引用是一个常量,而并非闭包内容本身。</p>
|
||||||
|
<p>这也意味着如果您将闭包赋值给了两个不同的常量/变量,两个值都会指向同一个闭包:</p>
|
||||||
|
<pre><code>let alsoIncrementByTen = incrementByTen
|
||||||
|
alsoIncrementByTen()
|
||||||
|
// 返回的值为50
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.8" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.8" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.9" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.9" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,7 +576,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_15">
|
<section class="normal" id="section-gitbook_17">
|
||||||
|
|
||||||
<h3 id="-">类和结构体</h3>
|
<h3 id="-">类和结构体</h3>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.10" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.10" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.11" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.11" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.12" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.12" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.13" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.13" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -584,7 +584,7 @@
|
|||||||
<a href="../chapter2/12_Subscripts.html" class="navigation navigation-prev " aria-label="Previous page: 下标"><i class="fa fa-angle-left"></i></a>
|
<a href="../chapter2/12_Subscripts.html" class="navigation navigation-prev " aria-label="Previous page: 下标"><i class="fa fa-angle-left"></i></a>
|
||||||
|
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" class="navigation navigation-next " aria-label="Next page: 构造过程"><i class="fa fa-angle-right"></i></a>
|
<a href="../chapter2/14_Initialization.html" class="navigation navigation-next " aria-label="Next page: 构造函数"><i class="fa fa-angle-right"></i></a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>构造过程 | Swift 编程语言</title>
|
<title>构造函数 | Swift 编程语言</title>
|
||||||
|
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||||
<meta name="robots" content="index, follow">
|
<meta name="robots" content="index, follow">
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<link rel="prev" href="../chapter2/13_Inheritance.html" />
|
<link rel="prev" href="../chapter2/13_Inheritance.html" />
|
||||||
|
|
||||||
|
|
||||||
<meta property="og:title" content="构造过程 | Swift 编程语言">
|
<meta property="og:title" content="构造函数 | Swift 编程语言">
|
||||||
<meta property="og:site_name" content="Swift 编程语言">
|
<meta property="og:site_name" content="Swift 编程语言">
|
||||||
<meta property="og:type" content="book">
|
<meta property="og:type" content="book">
|
||||||
<meta property="og:locale" content="en_US">
|
<meta property="og:locale" content="en_US">
|
||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.14" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.14" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -584,7 +584,7 @@
|
|||||||
<a href="../chapter2/13_Inheritance.html" class="navigation navigation-prev " aria-label="Previous page: 继承"><i class="fa fa-angle-left"></i></a>
|
<a href="../chapter2/13_Inheritance.html" class="navigation navigation-prev " aria-label="Previous page: 继承"><i class="fa fa-angle-left"></i></a>
|
||||||
|
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" class="navigation navigation-next " aria-label="Next page: 析构过程"><i class="fa fa-angle-right"></i></a>
|
<a href="../chapter2/15_Deinitialization.html" class="navigation navigation-next " aria-label="Next page: 析构函数"><i class="fa fa-angle-right"></i></a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>析构过程 | Swift 编程语言</title>
|
<title>析构函数 | Swift 编程语言</title>
|
||||||
|
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||||
<meta name="robots" content="index, follow">
|
<meta name="robots" content="index, follow">
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<link rel="prev" href="../chapter2/14_Initialization.html" />
|
<link rel="prev" href="../chapter2/14_Initialization.html" />
|
||||||
|
|
||||||
|
|
||||||
<meta property="og:title" content="析构过程 | Swift 编程语言">
|
<meta property="og:title" content="析构函数 | Swift 编程语言">
|
||||||
<meta property="og:site_name" content="Swift 编程语言">
|
<meta property="og:site_name" content="Swift 编程语言">
|
||||||
<meta property="og:type" content="book">
|
<meta property="og:type" content="book">
|
||||||
<meta property="og:locale" content="en_US">
|
<meta property="og:locale" content="en_US">
|
||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.15" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.15" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -581,7 +581,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" class="navigation navigation-prev " aria-label="Previous page: 构造过程"><i class="fa fa-angle-left"></i></a>
|
<a href="../chapter2/14_Initialization.html" class="navigation navigation-prev " aria-label="Previous page: 构造函数"><i class="fa fa-angle-left"></i></a>
|
||||||
|
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" class="navigation navigation-next " aria-label="Next page: 自动引用计数"><i class="fa fa-angle-right"></i></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" class="navigation navigation-next " aria-label="Next page: 自动引用计数"><i class="fa fa-angle-right"></i></a>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.16" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.16" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,7 +576,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_22">
|
<section class="normal" id="section-gitbook_24">
|
||||||
|
|
||||||
<h1 id="-">自动引用计数</h1>
|
<h1 id="-">自动引用计数</h1>
|
||||||
<p>Swift使用自动引用计数(ARC)这一机制来跟踪和管理你的应用程序的内存。通常情况下,Swift的内存管理机制会一直起着作用,你无须自己来考虑内存的管理。ARC会在类的实例不再被使用时,自动释放其占用的内存。</p>
|
<p>Swift使用自动引用计数(ARC)这一机制来跟踪和管理你的应用程序的内存。通常情况下,Swift的内存管理机制会一直起着作用,你无须自己来考虑内存的管理。ARC会在类的实例不再被使用时,自动释放其占用的内存。</p>
|
||||||
@ -599,7 +599,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" class="navigation navigation-prev " aria-label="Previous page: 析构过程"><i class="fa fa-angle-left"></i></a>
|
<a href="../chapter2/15_Deinitialization.html" class="navigation navigation-prev " aria-label="Previous page: 析构函数"><i class="fa fa-angle-left"></i></a>
|
||||||
|
|
||||||
|
|
||||||
<a href="../chapter2/17_Optional_Chaining.html" class="navigation navigation-next " aria-label="Next page: 可选链"><i class="fa fa-angle-right"></i></a>
|
<a href="../chapter2/17_Optional_Chaining.html" class="navigation navigation-next " aria-label="Next page: 可选链"><i class="fa fa-angle-right"></i></a>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.17" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.17" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.18" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.18" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.19" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.19" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,7 +576,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_25">
|
<section class="normal" id="section-gitbook_27">
|
||||||
|
|
||||||
<h1 id="-">类型嵌套</h1>
|
<h1 id="-">类型嵌套</h1>
|
||||||
<p>枚举类型常被用于实现特定类或结构体的功能。也能够在有多种变量类型的环境中,方便地定义通用类或结构体来使用,为了实现这种功能,Swift允许你定义类型嵌套,可以在枚举类型、类和结构体中定义支持嵌套的类型。</p>
|
<p>枚举类型常被用于实现特定类或结构体的功能。也能够在有多种变量类型的环境中,方便地定义通用类或结构体来使用,为了实现这种功能,Swift允许你定义类型嵌套,可以在枚举类型、类和结构体中定义支持嵌套的类型。</p>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.20" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.20" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.21" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.21" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.22" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.22" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2.23" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2.23" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="2" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="2" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,7 +576,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_30">
|
<section class="normal" id="section-gitbook_32">
|
||||||
|
|
||||||
<h1 id="swift-">Swift 教程</h1>
|
<h1 id="swift-">Swift 教程</h1>
|
||||||
<p>本章介绍了 Swift 的各种特性及其使用方法,是全书的核心部分。</p>
|
<p>本章介绍了 Swift 的各种特性及其使用方法,是全书的核心部分。</p>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="3.1" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="3.1" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -576,7 +576,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_31">
|
<section class="normal" id="section-gitbook_33">
|
||||||
|
|
||||||
<h1 id="-">关于语言附注</h1>
|
<h1 id="-">关于语言附注</h1>
|
||||||
<p>本书的这一节描述了Swift编程语言的形式语法。这里描述的语法是为了帮助您更详细的了解该语言,而不是让您直接实现一个解析器或编译器。</p>
|
<p>本书的这一节描述了Swift编程语言的形式语法。这里描述的语法是为了帮助您更详细的了解该语言,而不是让您直接实现一个解析器或编译器。</p>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="3.2" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="3.2" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="3.3" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="3.3" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="3.4" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="3.4" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="3.5" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="3.5" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="3.6" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="3.6" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="3.7" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="3.7" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="3.8" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="3.8" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="3.9" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="3.9" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -284,7 +284,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -293,7 +293,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -513,9 +513,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="3" data-basepath=".." data-revision="1402008022544">
|
<div class="book" data-level="3" data-basepath=".." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -286,7 +286,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html">
|
<a href="../chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +295,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html">
|
<a href="../chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -515,9 +515,9 @@
|
|||||||
|
|
||||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/14_Initialization.html" title="构造过程" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="../chapter2/14_Initialization.html" title="构造函数" class="chapter done " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/15_Deinitialization.html" title="析构过程" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="../chapter2/15_Deinitialization.html" title="析构函数" class="chapter done " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="../chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter done " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
|
|||||||
12
index.html
12
index.html
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="book" data-level="0" data-basepath="." data-revision="1402008022544">
|
<div class="book" data-level="0" data-basepath="." data-revision="1402037948812">
|
||||||
<div class="book-header">
|
<div class="book-header">
|
||||||
<!-- Actions Left -->
|
<!-- Actions Left -->
|
||||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||||
@ -284,7 +284,7 @@
|
|||||||
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
<li class="chapter " data-level="2.14" data-path="chapter2/14_Initialization.html">
|
||||||
|
|
||||||
<a href="./chapter2/14_Initialization.html">
|
<a href="./chapter2/14_Initialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.14.</b> 构造过程
|
<i class="fa fa-check"></i> <b>2.14.</b> 构造函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -293,7 +293,7 @@
|
|||||||
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
<li class="chapter " data-level="2.15" data-path="chapter2/15_Deinitialization.html">
|
||||||
|
|
||||||
<a href="./chapter2/15_Deinitialization.html">
|
<a href="./chapter2/15_Deinitialization.html">
|
||||||
<i class="fa fa-check"></i> <b>2.15.</b> 析构过程
|
<i class="fa fa-check"></i> <b>2.15.</b> 析构函数
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
@ -513,9 +513,9 @@
|
|||||||
|
|
||||||
<a href="./chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
<a href="./chapter2/13_Inheritance.html" title="继承" class="chapter " data-progress="2.13" style="left: 24.324324324324323%;"></a>
|
||||||
|
|
||||||
<a href="./chapter2/14_Initialization.html" title="构造过程" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
<a href="./chapter2/14_Initialization.html" title="构造函数" class="chapter " data-progress="2.14" style="left: 27.027027027027028%;"></a>
|
||||||
|
|
||||||
<a href="./chapter2/15_Deinitialization.html" title="析构过程" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
<a href="./chapter2/15_Deinitialization.html" title="析构函数" class="chapter " data-progress="2.15" style="left: 29.72972972972973%;"></a>
|
||||||
|
|
||||||
<a href="./chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
<a href="./chapter2/16_Automatic_Reference_Counting.html" title="自动引用计数" class="chapter " data-progress="2.16" style="left: 32.432432432432435%;"></a>
|
||||||
|
|
||||||
@ -574,7 +574,7 @@
|
|||||||
|
|
||||||
<div class="page-inner">
|
<div class="page-inner">
|
||||||
|
|
||||||
<section class="normal" id="section-gitbook_3">
|
<section class="normal" id="section-gitbook_5">
|
||||||
|
|
||||||
<h1 id="swift-">Swift 编程语言</h1>
|
<h1 id="swift-">Swift 编程语言</h1>
|
||||||
<p>Swift 是苹果在 WWDC 2014 上发布的一款全新的编程语言,本书译自苹果官方的 Swift 教程《The Swift Programming Language》。</p>
|
<p>Swift 是苹果在 WWDC 2014 上发布的一款全新的编程语言,本书译自苹果官方的 Swift 教程《The Swift Programming Language》。</p>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
# Revision 1402008022545
|
# Revision 1402037948813
|
||||||
|
|
||||||
CACHE:
|
CACHE:
|
||||||
index.html
|
index.html
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user