<spanclass="x-name"><ahref="TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-XID_478"data-id="//apple_ref/doc/uid/TP40014097-CH5-XID_478">Optionals</a></span> no longer implicitly evaluate to <codeclass="code-voice">true</code> when they have a value and <codeclass="code-voice">false</code> when they do not, to avoid confusion when working with optional <codeclass="code-voice">Bool</code> values. Instead, make an explicit check against <codeclass="code-voice">nil</code> with the <codeclass="code-voice">==</code> or <codeclass="code-voice">!=</code> operators to find out if an optional contains a value.
</p>
</li><liclass="item"><pclass="para">
Swift now has a <spanclass="x-name"><ahref="BasicOperators.html#//apple_ref/doc/uid/TP40014097-CH6-XID_124"data-id="//apple_ref/doc/uid/TP40014097-CH6-XID_124">Nil Coalescing Operator</a></span> (<codeclass="code-voice">a ?? b</code>), which unwraps an optional’s value if it exists, or returns a default value if the optional is <codeclass="code-voice">nil</code>.
</p>
</li><liclass="item"><pclass="para">
Updated and expanded the <spanclass="x-name"><ahref="StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-XID_434"data-id="//apple_ref/doc/uid/TP40014097-CH7-XID_434">Comparing Strings</a></span> section to reflect and demonstrate that string and character comparison and prefix / suffix comparison are now based on Unicode canonical equivalence of extended grapheme clusters.
</p>
</li><liclass="item"><pclass="para">
You can now try to set a property’s value, assign to a subscript, or call a mutating method or operator through <spanclass="x-name"><ahref="OptionalChaining.html#//apple_ref/doc/uid/TP40014097-CH21-XID_356"data-id="//apple_ref/doc/uid/TP40014097-CH21-XID_356">Optional Chaining</a></span>. The information about <spanclass="x-name"><ahref="OptionalChaining.html#//apple_ref/doc/uid/TP40014097-CH21-XID_360"data-id="//apple_ref/doc/uid/TP40014097-CH21-XID_360">Accessing Properties Through Optional Chaining</a></span> has been updated accordingly, and the examples of checking for method call success in <spanclass="x-name"><ahref="OptionalChaining.html#//apple_ref/doc/uid/TP40014097-CH21-XID_361"data-id="//apple_ref/doc/uid/TP40014097-CH21-XID_361">Calling Methods Through Optional Chaining</a></span> have been expanded to show how to check for property setting success.
</p>
</li><liclass="item"><pclass="para">
Added a new section about <spanclass="x-name"><ahref="OptionalChaining.html#//apple_ref/doc/uid/TP40014097-CH21-XID_364"data-id="//apple_ref/doc/uid/TP40014097-CH21-XID_364">Accessing Subscripts of Optional Type</a></span> through optional chaining.
</p>
</li><liclass="item"><pclass="para">
Updated the <spanclass="x-name"><ahref="CollectionTypes.html#//apple_ref/doc/uid/TP40014097-CH8-XID_176"data-id="//apple_ref/doc/uid/TP40014097-CH8-XID_176">Accessing and Modifying an Array</a></span> section to note that you can no longer append a single item to an array with the <codeclass="code-voice">+=</code> operator. Instead, use the <codeclass="code-voice">append</code> method, or append a single-item array with the <codeclass="code-voice">+=</code> operator.
</p>
</li><liclass="item"><pclass="para">
Added a note that the start value <codeclass="code-voice">a</code> for the <spanclass="x-name"><ahref="BasicOperators.html#//apple_ref/doc/uid/TP40014097-CH6-XID_126"data-id="//apple_ref/doc/uid/TP40014097-CH6-XID_126">Range Operators</a></span><codeclass="code-voice">a...b</code> and <codeclass="code-voice">a..<b</code> must not be greater than the end value <codeclass="code-voice">b</code>.
</p>
</li><liclass="item"><pclass="para">
Rewrote the <spanclass="x-name"><ahref="Inheritance.html#//apple_ref/doc/uid/TP40014097-CH17-XID_293"data-id="//apple_ref/doc/uid/TP40014097-CH17-XID_293">Inheritance</a></span> chapter to remove its introductory coverage of initializer overrides. This chapter now focuses more on the addition of new functionality in a subclass, and the modification of existing functionality with overrides. The chapter’s example of <spanclass="x-name"><ahref="Inheritance.html#//apple_ref/doc/uid/TP40014097-CH17-XID_301"data-id="//apple_ref/doc/uid/TP40014097-CH17-XID_301">Overriding Property Getters and Setters</a></span> has been rewritten to show how to override a <codeclass="code-voice">description</code> property. (The examples of modifying an inherited property’s default value in a subclass initializer have been moved to the <spanclass="x-name"><ahref="Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-XID_306"data-id="//apple_ref/doc/uid/TP40014097-CH18-XID_306">Initialization</a></span> chapter.)
</p>
</li><liclass="item"><pclass="para">
Updated the <spanclass="x-name"><ahref="Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-XID_331"data-id="//apple_ref/doc/uid/TP40014097-CH18-XID_331">Initializer Inheritance and Overriding</a></span> section to note that overrides of a designated initializer must now be marked with the <codeclass="code-voice">override</code> modifier.
</p>
</li><liclass="item"><pclass="para">
Updated the <spanclass="x-name"><ahref="Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-XID_339"data-id="//apple_ref/doc/uid/TP40014097-CH18-XID_339">Required Initializers</a></span> section to note that the <codeclass="code-voice">required</code> modifier is now written before every subclass implementation of a required initializer, and that the requirements for required initializers can now be satisfied by automatically inherited initializers.
</p>
</li><liclass="item"><pclass="para">
Infix <spanclass="x-name"><ahref="AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-XID_80"data-id="//apple_ref/doc/uid/TP40014097-CH27-XID_80">Operator Functions</a></span> no longer require the <codeclass="code-voice">@infix</code> attribute.
</p>
</li><liclass="item"><pclass="para">
The <codeclass="code-voice">@prefix</code> and <codeclass="code-voice">@postfix</code> attributes for <spanclass="x-name"><ahref="AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-XID_81"data-id="//apple_ref/doc/uid/TP40014097-CH27-XID_81">Prefix and Postfix Operators</a></span> have been replaced by <codeclass="code-voice">prefix</code> and <codeclass="code-voice">postfix</code> declaration modifiers.
</p>
</li><liclass="item"><pclass="para">
Added a note about the order in which <spanclass="x-name"><ahref="AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-XID_81"data-id="//apple_ref/doc/uid/TP40014097-CH27-XID_81">Prefix and Postfix Operators</a></span> are applied when both a prefix and a postfix operator are applied to the same operand.
</p>
</li><liclass="item"><pclass="para">
Operator functions for <spanclass="x-name"><ahref="AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-XID_82"data-id="//apple_ref/doc/uid/TP40014097-CH27-XID_82">Compound Assignment Operators</a></span> no longer use the <codeclass="code-voice">@assignment</code> attribute when defining the function.
</p>
</li><liclass="item"><pclass="para">
The order in which modifiers are specified when defining <spanclass="x-name"><ahref="AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-XID_85"data-id="//apple_ref/doc/uid/TP40014097-CH27-XID_85">Custom Operators</a></span> has changed. You now write <codeclass="code-voice">prefix operator</code> rather than <codeclass="code-voice">operator prefix</code>, for example.
</p>
</li><liclass="item"><pclass="para">
Added information about the <codeclass="code-voice">dynamic</code> declaration modifier in <spanclass="x-name"><ahref="Declarations.html#//apple_ref/doc/uid/TP40014097-CH34-XID_705"data-id="//apple_ref/doc/uid/TP40014097-CH34-XID_705">Declaration Modifiers</a></span>.
</p>
</li><liclass="item"><pclass="para">
Added information about how type inference works with <spanclass="x-name"><ahref="LexicalStructure.html#//apple_ref/doc/uid/TP40014097-CH30-XID_886"data-id="//apple_ref/doc/uid/TP40014097-CH30-XID_886">Literals</a></span>.
</p>
</li><liclass="item"><pclass="para">
Added more information about <spanclass="x-name"><ahref="Declarations.html#//apple_ref/doc/uid/TP40014097-CH34-XID_597"data-id="//apple_ref/doc/uid/TP40014097-CH34-XID_597">Curried Functions</a></span>.
</p>
</li>
</ul></td>
</tr>
<tr>
<tdscope="row"><pclass="para">
2014-07-21
</p></td>
<td><ulclass="list-bullet">
<liclass="item"><pclass="para">
Added a new chapter about <spanclass="x-name"><ahref="AccessControl.html#//apple_ref/doc/uid/TP40014097-CH41-XID_29"data-id="//apple_ref/doc/uid/TP40014097-CH41-XID_29">Access Control</a></span>.
</p>
</li><liclass="item"><pclass="para">
Updated the <spanclass="x-name"><ahref="StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-XID_413"data-id="//apple_ref/doc/uid/TP40014097-CH7-XID_413">Strings and Characters</a></span> chapter to reflect the fact that Swift’s <codeclass="code-voice">Character</code> type now represents a single Unicode extended grapheme cluster. Includes a new section on <spanclass="x-name"><ahref="StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-XID_431"data-id="//apple_ref/doc/uid/TP40014097-CH7-XID_431">Extended Grapheme Clusters</a></span> and more information about <spanclass="x-name"><ahref="StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-XID_428"data-id="//apple_ref/doc/uid/TP40014097-CH7-XID_428">Unicode Scalars</a></span> and <spanclass="x-name"><ahref="StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-XID_434"data-id="//apple_ref/doc/uid/TP40014097-CH7-XID_434">Comparing Strings</a></span>.
</p>
</li><liclass="item"><pclass="para">
Updated the <spanclass="x-name"><ahref="StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-XID_415"data-id="//apple_ref/doc/uid/TP40014097-CH7-XID_415">String Literals</a></span> section to note that Unicode scalars inside string literals are now written as <codeclass="code-voice">\u{n}</code>, where <codeclass="code-voice">n</code> is between one and eight hexadecimal digits.
</p>
</li><liclass="item"><pclass="para">
The <codeclass="code-voice">NSString</code><codeclass="code-voice">length</code> property is now mapped onto Swift’s native <codeclass="code-voice">String</code> type as <codeclass="code-voice">utf16Count</code>, not <codeclass="code-voice">utf16count</code>.
</p>
</li><liclass="item"><pclass="para">
Swift’s native <codeclass="code-voice">String</code> type no longer has an <codeclass="code-voice">uppercaseString</code> or <codeclass="code-voice">lowercaseString</code> property. The corresponding section in <spanclass="x-name"><ahref="StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-XID_413"data-id="//apple_ref/doc/uid/TP40014097-CH7-XID_413">Strings and Characters</a></span> has been removed, and various code examples have been updated.
</p>
</li><liclass="item"><pclass="para">
Added a new section about <spanclass="x-name"><ahref="Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-XID_315"data-id="//apple_ref/doc/uid/TP40014097-CH18-XID_315">Initializer Parameters Without External Names</a></span>.
</p>
</li><liclass="item"><pclass="para">
Added a new section about <spanclass="x-name"><ahref="Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-XID_339"data-id="//apple_ref/doc/uid/TP40014097-CH18-XID_339">Required Initializers</a></span>.
</p>
</li><liclass="item"><pclass="para">
Added a new section about <spanclass="x-name"><ahref="Functions.html#//apple_ref/doc/uid/TP40014097-CH10-XID_252"data-id="//apple_ref/doc/uid/TP40014097-CH10-XID_252">Optional Tuple Return Types</a></span>.
</p>
</li><liclass="item"><pclass="para">
Updated the <spanclass="x-name"><ahref="TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-XID_453"data-id="//apple_ref/doc/uid/TP40014097-CH5-XID_453">Type Annotations</a></span> section to note that multiple related variables can be defined on a single line with one type annotation.
</p>
</li><liclass="item"><pclass="para">
The <codeclass="code-voice">@optional</code>, <codeclass="code-voice">@lazy</code>, <codeclass="code-voice">@final</code>, and <codeclass="code-voice">@required</code> attributes are now the <codeclass="code-voice">optional</code>, <codeclass="code-voice">lazy</code>, <codeclass="code-voice">final</code>, and <codeclass="code-voice">required</code><spanclass="x-name"><ahref="Declarations.html#//apple_ref/doc/uid/TP40014097-CH34-XID_705"data-id="//apple_ref/doc/uid/TP40014097-CH34-XID_705">Declaration Modifiers</a></span>.
</p>
</li><liclass="item"><pclass="para">
Updated the entire book to refer to <codeclass="code-voice">..<</code> as the <spanclass="x-name"><ahref="BasicOperators.html#//apple_ref/doc/uid/TP40014097-CH6-XID_128"data-id="//apple_ref/doc/uid/TP40014097-CH6-XID_128">Half-Open Range Operator</a></span> (rather than the “half-closed range operator”).
</p>
</li><liclass="item"><pclass="para">
Updated the <spanclass="x-name"><ahref="CollectionTypes.html#//apple_ref/doc/uid/TP40014097-CH8-XID_185"data-id="//apple_ref/doc/uid/TP40014097-CH8-XID_185">Accessing and Modifying a Dictionary</a></span> section to note that <codeclass="code-voice">Dictionary</code> now has a Boolean <codeclass="code-voice">isEmpty</code> property.
</p>
</li><liclass="item"><pclass="para">
Clarified the full list of characters that can be used when defining <spanclass="x-name"><ahref="AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-XID_85"data-id="//apple_ref/doc/uid/TP40014097-CH27-XID_85">Custom Operators</a></span>.
</p>
</li><liclass="item"><pclass="para">
<codeclass="code-voice">nil</code> and the Booleans <codeclass="code-voice">true</code> and <codeclass="code-voice">false</code> are now <spanclass="x-name"><ahref="LexicalStructure.html#//apple_ref/doc/uid/TP40014097-CH30-XID_886"data-id="//apple_ref/doc/uid/TP40014097-CH30-XID_886">Literals</a></span>.
</p>
</li>
</ul></td>
</tr>
<tr>
<tdscope="row"><pclass="para">
2014-07-07
</p></td>
<td><ulclass="list-bullet">
<liclass="item"><pclass="para">
Swift’s <codeclass="code-voice">Array</code> type now has full value semantics. Updated the information about <spanclass="x-name"><ahref="CollectionTypes.html#//apple_ref/doc/uid/TP40014097-CH8-XID_170"data-id="//apple_ref/doc/uid/TP40014097-CH8-XID_170">Mutability of Collections</a></span> and <spanclass="x-name"><ahref="CollectionTypes.html#//apple_ref/doc/uid/TP40014097-CH8-XID_172"data-id="//apple_ref/doc/uid/TP40014097-CH8-XID_172">Arrays</a></span> to reflect the new approach. Also clarified the <spanclass="x-name"><ahref="ClassesAndStructures.html#//apple_ref/doc/uid/TP40014097-CH13-XID_150"data-id="//apple_ref/doc/uid/TP40014097-CH13-XID_150">Assignment and Copy Behavior for Strings, Arrays, and Dictionaries</a></span>.
</p>
</li><li>
<spanclass="x-name"><ahref="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/CollectionTypes.html#//apple_ref/doc/uid/TP40014097-CH8-XID_173">数组类型速记语法(Array Type Shorthand Syntax)</a></span> 从 <code>SomeType[]</code>.更新为<code>[SomeType]</code>
</p>
</li><li>
加入新的小节:<ahref="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/CollectionTypes.html#//apple_ref/doc/uid/TP40014097-CH8-XID_182">字典类型的速记语法(Dictionary Type Shorthand Syntax)</a>.:<code>[KeyType: ValueType]</code>.
</p>
</li><li>
加入新的小节:<ahref="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/CollectionTypes.html#//apple_ref/doc/uid/TP40014097-CH8-XID_189">字典键类型的哈希值(Hash Values for Dictionary Key Types)</a>.
更新关于 <ahref="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-XID_320">结构体逐一成员构造器 (Memberwise Initializers for Structure Types)</a> 的描述:即使结构体的成员<b>没有默认值</b>,逐一成员构造器也可以自动获得。
</p>
</li>
<li><ahref="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/BasicOperators.html#//apple_ref/doc/uid/TP40014097-CH6-XID_128">区间运算符(Half-Open Range Operator)</a>由<code>..</code>更新到<code>..<</code>
<p>
<li>添加一个例子 <ahref="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Generics.html#//apple_ref/doc/uid/TP40014097-CH26-XID_285">扩展一个泛型(Extending a Generic Type)</a>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.