Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
Add v3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mattt committed Aug 10, 2018
1 parent d7a85ca commit ea584b9
Show file tree
Hide file tree
Showing 899 changed files with 346,114 additions and 0 deletions.
1 change: 1 addition & 0 deletions v3.1/assets/js/swift-linkdata.js

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions v3.1/func/abs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
layout: "default"
title: "abs"
description: "Swift documentation for 'abs': Returns the absolute value of x."
keywords: "abs,func,swift,documentation"
root: "/v3.1"
---

<div class="declaration" id="func-abs-t-where-t_-signednumber_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-abs-t-where-t_-signednumber_-t">func <wbr>abs&lt;T where T : SignedNumber&gt;(<wbr>_: T)</a>

<div class="comment collapse" id="comment-func-abs-t-where-t_-signednumber_-t"><div class="p">
<p>Returns the absolute value of <code>x</code>.</p>

<p>Concrete instances of <code>SignedNumber</code> can specialize this
function by conforming to <code>AbsoluteValuable</code>.</p>

<h4>Declaration</h4>
<code class="language-swift">func abs&lt;T where T : SignedNumber&gt;(_ x: T) -&gt; T</code>


</div></div>
</div>
<div class="declaration" id="func-abs-t-where-t_-floatingpoint-t-magnitude-t_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-abs-t-where-t_-floatingpoint-t-magnitude-t_-t">func <wbr>abs&lt;T where T : FloatingPoint, T.Magnitude == T&gt;(<wbr>_: T)</a>

<div class="comment collapse" id="comment-func-abs-t-where-t_-floatingpoint-t-magnitude-t_-t"><div class="p">
<p>Returns the absolute value of <code>x</code>.</p>

<h4>Declaration</h4>
<code class="language-swift">func abs&lt;T where T : FloatingPoint, T.Magnitude == T&gt;(_ x: T) -&gt; T</code>


</div></div>
</div>
42 changes: 42 additions & 0 deletions v3.1/func/assert/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
layout: "default"
title: "assert"
description: "Swift documentation for 'assert': Performs a traditional C-style assert with an optional message."
keywords: "assert,func,swift,documentation"
root: "/v3.1"
---

<div class="declaration" id="func-assert_-autoclosure-bool_-autoclosure-string-file_-staticstring-line_-uint">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-assert_-autoclosure-bool_-autoclosure-string-file_-staticstring-line_-uint">func assert(<wbr>_: @autoclosure (<wbr>) -&gt; Bool, _: @autoclosure (<wbr>) -&gt; String, file:<wbr> StaticString, line: UInt)</a>

<div class="comment collapse" id="comment-func-assert_-autoclosure-bool_-autoclosure-string-file_-staticstring-line_-uint"><div class="p">
<p>Performs a traditional C-style assert with an optional message.</p>

<p>Use this function for internal sanity checks that are active during testing
but do not impact performance of shipping code. To check for invalid usage
in Release builds, see <code>precondition(_:_:file:line:)</code>.</p>

<ul><li><p>In playgrounds and <code>-Onone</code> builds (the default for Xcode&#39;s Debug
configuration): If <code>condition</code> evaluates to <code>false</code>, stop program
execution in a debuggable state after printing <code>message</code>.</p></li><li><p>In <code>-O</code> builds (the default for Xcode&#39;s Release configuration),
<code>condition</code> is not evaluated, and there are no effects.</p></li><li><p>In <code>-Ounchecked</code> builds, <code>condition</code> is not evaluated, but the optimizer
may assume that it <em>always</em> evaluates to <code>true</code>. Failure to satisfy that
assumption is a serious programming error.</p></li></ul>

<p><strong>Parameters:</strong>
<strong>condition:</strong> The condition to test. <code>condition</code> is only evaluated in
playgrounds and <code>-Onone</code> builds.
<strong>message:</strong> A string to print if <code>condition</code> is evaluated to <code>false</code>. The
default is an empty string.
<strong>file:</strong> The file name to print with <code>message</code> if the assertion fails. The
default is the file where <code>assert(_:_:file:line:)</code> is called.
<strong>line:</strong> The line number to print along with <code>message</code> if the assertion
fails. The default is the line number where <code>assert(_:_:file:line:)</code>
is called.</p>

<h4>Declaration</h4>
<code class="language-swift">func assert(_ condition: @autoclosure () -&gt; Bool, _ message: @autoclosure () -&gt; String = default, file: StaticString = #file, line: UInt = #line)</code>


</div></div>
</div>
40 changes: 40 additions & 0 deletions v3.1/func/assertionFailure/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
layout: "default"
title: "assertionFailure"
description: "Swift documentation for 'assertionFailure': Indicates that an internal sanity check failed."
keywords: "assertionFailure,func,swift,documentation"
root: "/v3.1"
---

<div class="declaration" id="func-assertionfailure_-autoclosure-string-file_-staticstring-line_-uint">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-assertionfailure_-autoclosure-string-file_-staticstring-line_-uint">func assertionFailure(<wbr>_: @autoclosure (<wbr>) -&gt; String, file:<wbr> StaticString, line: UInt)</a>

<div class="comment collapse" id="comment-func-assertionfailure_-autoclosure-string-file_-staticstring-line_-uint"><div class="p">
<p>Indicates that an internal sanity check failed.</p>

<p>Use this function to stop the program, without impacting the performance of
shipping code, when control flow is not expected to reach the call---for
example, in the <code>default</code> case of a <code>switch</code> where you have knowledge that
one of the other cases must be satisfied. To protect code from invalid
usage in Release builds, see <code>preconditionFailure(_:file:line:)</code>.</p>

<ul><li><p>In playgrounds and -Onone builds (the default for Xcode&#39;s Debug
configuration), stop program execution in a debuggable state after
printing <code>message</code>.</p></li><li><p>In -O builds, has no effect.</p></li><li><p>In -Ounchecked builds, the optimizer may assume that this function is
never called. Failure to satisfy that assumption is a serious
programming error.</p></li></ul>

<p><strong>Parameters:</strong>
<strong>message:</strong> A string to print in a playground or <code>-Onone</code> build. The
default is an empty string.
<strong>file:</strong> The file name to print with <code>message</code>. The default is the file
where <code>assertionFailure(_:file:line:)</code> is called.
<strong>line:</strong> The line number to print along with <code>message</code>. The default is the
line number where <code>assertionFailure(_:file:line:)</code> is called.</p>

<h4>Declaration</h4>
<code class="language-swift">func assertionFailure(_ message: @autoclosure () -&gt; String = default, file: StaticString = #file, line: UInt = #line)</code>


</div></div>
</div>
116 changes: 116 additions & 0 deletions v3.1/func/debugPrint/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
layout: "default"
title: "debugPrint"
description: "Swift documentation for 'debugPrint': Writes the textual representations of the given items most suitable for."
keywords: "debugPrint,func,swift,documentation"
root: "/v3.1"
---

<div class="declaration" id="func-debugprint_-any-separator_-string-terminator_-string">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-debugprint_-any-separator_-string-terminator_-string">func debugPrint(<wbr>_:<wbr> Any..., separator:<wbr> String, terminator: String)</a>

<div class="comment collapse" id="comment-func-debugprint_-any-separator_-string-terminator_-string"><div class="p">
<p>Writes the textual representations of the given items most suitable for
debugging into the standard output.</p>

<p>You can pass zero or more items to the
<code>debugPrint(_:separator:terminator:)</code> function. The textual representation
for each item is the same as that obtained by calling
<code>String(reflecting: item)</code>. The following example prints the debugging
representation of a string, a closed range of integers, and a group of
floating-point values to standard output:</p>

<pre><code class="language-swift">debugPrint(&quot;One two three four five&quot;)
// Prints &quot;One two three four five&quot;

debugPrint(1...5)
// Prints &quot;CountableClosedRange(1...5)&quot;

debugPrint(1.0, 2.0, 3.0, 4.0, 5.0)
// Prints &quot;1.0 2.0 3.0 4.0 5.0&quot;</code></pre>

<p>To print the items separated by something other than a space, pass a string
as <code>separator</code>.</p>

<pre><code class="language-swift">debugPrint(1.0, 2.0, 3.0, 4.0, 5.0, separator: &quot; ... &quot;)
// Prints &quot;1.0 ... 2.0 ... 3.0 ... 4.0 ... 5.0&quot;</code></pre>

<p>The output from each call to <code>debugPrint(_:separator:terminator:)</code> includes
a newline by default. To print the items without a trailing newline, pass
an empty string as <code>terminator</code>.</p>

<pre><code class="language-swift">for n in 1...5 {
debugPrint(n, terminator: &quot;&quot;)
}
// Prints &quot;12345&quot;</code></pre>

<p><strong>Parameters:</strong>
<strong>items:</strong> Zero or more items to print.
<strong>separator:</strong> A string to print between each item. The default is a single
space (<code>&quot; &quot;</code>).
<strong>terminator:</strong> The string to print after all items have been printed. The
default is a newline (<code>&quot;\n&quot;</code>).</p>

<p><strong>See Also:</strong> <code>print(_:separator:terminator:)</code>, <code>TextOutputStreamable</code>,
<code>CustomStringConvertible</code>, <code>CustomDebugStringConvertible</code></p>

<h4>Declaration</h4>
<code class="language-swift">func debugPrint(_ items: Any..., separator: String = default, terminator: String = default)</code>


</div></div>
</div>
<div class="declaration" id="func-debugprint-target-where-target_-textoutputstream_-any-separator_-string-terminator_-string-to_-inout-target">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-debugprint-target-where-target_-textoutputstream_-any-separator_-string-terminator_-string-to_-inout-target">func <wbr>debugPrint&lt;Target where Target : TextOutputStream&gt;(<wbr>_:<wbr> Any..., separator:<wbr> String, terminator:<wbr> String, to: inout Target)</a>

<div class="comment collapse" id="comment-func-debugprint-target-where-target_-textoutputstream_-any-separator_-string-terminator_-string-to_-inout-target"><div class="p">
<p>Writes the textual representations of the given items most suitable for
debugging into the given output stream.</p>

<p>You can pass zero or more items to the
<code>debugPrint(_:separator:terminator:to:)</code> function. The textual
representation for each item is the same as that obtained by calling
<code>String(reflecting: item)</code>. The following example prints a closed range of
integers to a string:</p>

<pre><code class="language-swift">var range = &quot;My range: &quot;
debugPrint(1...5, to: &amp;range)
// range == &quot;My range: CountableClosedRange(1...5)\n&quot;</code></pre>

<p>To print the items separated by something other than a space, pass a string
as <code>separator</code>.</p>

<pre><code class="language-swift">var separated = &quot;&quot;
debugPrint(1.0, 2.0, 3.0, 4.0, 5.0, separator: &quot; ... &quot;, to: &amp;separated)
// separated == &quot;1.0 ... 2.0 ... 3.0 ... 4.0 ... 5.0\n&quot;</code></pre>

<p>The output from each call to <code>debugPrint(_:separator:terminator:to:)</code>
includes a newline by default. To print the items without a trailing
newline, pass an empty string as <code>terminator</code>.</p>

<pre><code class="language-swift">var numbers = &quot;&quot;
for n in 1...5 {
debugPrint(n, terminator: &quot;&quot;, to: &amp;numbers)
}
// numbers == &quot;12345&quot;</code></pre>

<p><strong>Parameters:</strong>
<strong>items:</strong> Zero or more items to print.
<strong>separator:</strong> A string to print between each item. The default is a single
space (<code>&quot; &quot;</code>).
<strong>terminator:</strong> The string to print after all items have been printed. The
default is a newline (<code>&quot;\n&quot;</code>).
<strong>output:</strong> An output stream to receive the text representation of each
item.</p>

<p><strong>See Also:</strong> <code>debugPrint(_:separator:terminator:)</code>,
<code>print(_:separator:terminator:to:)</code>,
<code>TextOutputStream</code>, <code>TextOutputStreamable</code>,
<code>CustomStringConvertible</code>, <code>CustomDebugStringConvertible</code></p>

<h4>Declaration</h4>
<code class="language-swift">func debugPrint&lt;Target where Target : TextOutputStream&gt;(_ items: Any..., separator: String = default, terminator: String = default, to output: inout Target)</code>


</div></div>
</div>
32 changes: 32 additions & 0 deletions v3.1/func/dump/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
layout: "default"
title: "dump"
description: "Swift documentation for 'dump': Dumps an object&#39;s contents using its mirror to standard output."
keywords: "dump,func,swift,documentation"
root: "/v3.1"
---

<div class="declaration" id="func-dump-t_-t-name_-string-indent_-int-maxdepth_-int-maxitems_-int">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-dump-t_-t-name_-string-indent_-int-maxdepth_-int-maxitems_-int">func dump&lt;T&gt;(<wbr>_:<wbr> T, name:<wbr> String?, indent:<wbr> Int, maxDepth:<wbr> Int, maxItems: Int)</a>

<div class="comment collapse" id="comment-func-dump-t_-t-name_-string-indent_-int-maxdepth_-int-maxitems_-int"><div class="p">
<p>Dumps an object&#39;s contents using its mirror to standard output.</p>

<h4>Declaration</h4>
<code class="language-swift">func dump&lt;T&gt;(_ value: T, name: String? = default, indent: Int = default, maxDepth: Int = default, maxItems: Int = default) -&gt; T</code>


</div></div>
</div>
<div class="declaration" id="func-dump-t-targetstream-where-targetstream_-textoutputstream_-t-to_-inout-targetstream-name_-string-indent_-int-maxdepth_-int-maxitems_-int">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-dump-t-targetstream-where-targetstream_-textoutputstream_-t-to_-inout-targetstream-name_-string-indent_-int-maxdepth_-int-maxitems_-int">func <wbr>dump&lt;T, TargetStream where TargetStream : TextOutputStream&gt;(<wbr>_:<wbr> T, to:<wbr> inout TargetStream, name:<wbr> String?, indent:<wbr> Int, maxDepth:<wbr> Int, maxItems: Int)</a>

<div class="comment collapse" id="comment-func-dump-t-targetstream-where-targetstream_-textoutputstream_-t-to_-inout-targetstream-name_-string-indent_-int-maxdepth_-int-maxitems_-int"><div class="p">
<p>Dumps an object&#39;s contents using its mirror to the specified output stream.</p>

<h4>Declaration</h4>
<code class="language-swift">func dump&lt;T, TargetStream where TargetStream : TextOutputStream&gt;(_ value: T, to target: inout TargetStream, name: String? = default, indent: Int = default, maxDepth: Int = default, maxItems: Int = default) -&gt; T</code>


</div></div>
</div>
27 changes: 27 additions & 0 deletions v3.1/func/fatalError/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
layout: "default"
title: "fatalError"
description: "Swift documentation for 'fatalError': Unconditionally prints a given message and stops execution."
keywords: "fatalError,func,swift,documentation"
root: "/v3.1"
---

<div class="declaration" id="func-fatalerror_-autoclosure-string-file_-staticstring-line_-uint">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-fatalerror_-autoclosure-string-file_-staticstring-line_-uint">func fatalError(<wbr>_: @autoclosure (<wbr>) -&gt; String, file:<wbr> StaticString, line: UInt)</a>

<div class="comment collapse" id="comment-func-fatalerror_-autoclosure-string-file_-staticstring-line_-uint"><div class="p">
<p>Unconditionally prints a given message and stops execution.</p>

<p><strong>Parameters:</strong>
<strong>message:</strong> The string to print. The default is an empty string.
<strong>file:</strong> The file name to print with <code>message</code>. The default is the file
where <code>fatalError(_:file:line:)</code> is called.
<strong>line:</strong> The line number to print along with <code>message</code>. The default is the
line number where <code>fatalError(_:file:line:)</code> is called.</p>

<h4>Declaration</h4>
<code class="language-swift">func fatalError(_ message: @autoclosure () -&gt; String = default, file: StaticString = #file, line: UInt = #line) -&gt; Never</code>


</div></div>
</div>
31 changes: 31 additions & 0 deletions v3.1/func/getVaList/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
layout: "default"
title: "getVaList"
description: "Swift documentation for 'getVaList': Returns a CVaListPointer that is backed by autoreleased storage, built."
keywords: "getVaList,func,swift,documentation"
root: "/v3.1"
---

<div class="declaration" id="func-getvalist_-cvararg">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-getvalist_-cvararg">func getVaList(<wbr>_: [CVarArg])</a>

<div class="comment collapse" id="comment-func-getvalist_-cvararg"><div class="p">
<p>Returns a <code>CVaListPointer</code> that is backed by autoreleased storage, built
from the given array of arguments.</p>

<p>You should prefer <code>withVaList(_:_:)</code> instead of this function. In some
uses, such as in a <code>class</code> initializer, you may find that the
language rules do not allow you to use <code>withVaList(_:_:)</code> as intended.</p>

<ul><li>Parameters args: An array of arguments to convert to a C <code>va_list</code>
pointer.
<strong>Returns:</strong> The return value of the <code>body</code> closure parameter, if any.</li></ul>

<p><strong>See Also:</strong> <code>withVaList(_:_:)</code></p>

<h4>Declaration</h4>
<code class="language-swift">func getVaList(_ args: [CVarArg]) -&gt; CVaListPointer</code>


</div></div>
</div>
48 changes: 48 additions & 0 deletions v3.1/func/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
layout: "default"
title: "Global Functions"
description: "Documentation for all top-level, global functions in the Swift language."
root: "/v3.1"
---

<div class="row">
<div class="col-sm-6">
<ul class="main-list">
<li><a href="/v3.1/func/abs">abs</a></li>
<li><a href="/v3.1/func/assert">assert</a></li>
<li><a href="/v3.1/func/assertionFailure">assertionFailure</a></li>
<li><a href="/v3.1/func/debugPrint">debugPrint</a></li>
<li><a href="/v3.1/func/dump">dump</a></li>
<li><a href="/v3.1/func/fatalError">fatalError</a></li>
<li><a href="/v3.1/func/getVaList">getVaList</a></li>
<li><a href="/v3.1/func/isKnownUniquelyReferenced">isKnownUniquelyReferenced</a></li>
<li><a href="/v3.1/func/max">max</a></li>
<li><a href="/v3.1/func/min">min</a></li>
<li><a href="/v3.1/func/numericCast">numericCast</a></li>
<li><a href="/v3.1/func/precondition">precondition</a></li>
<li><a href="/v3.1/func/preconditionFailure">preconditionFailure</a></li>
<li><a href="/v3.1/func/print">print</a></li>
<li><a href="/v3.1/func/readLine">readLine</a></li>
<li><a href="/v3.1/func/repeatElement">repeatElement</a></li>
</ul>
</div>
<div class="col-sm-6">
<ul class="main-list">
<li><a href="/v3.1/func/sequence">sequence</a></li>
<li><a href="/v3.1/func/stride">stride</a></li>
<li><a href="/v3.1/func/swap">swap</a></li>
<li><a href="/v3.1/func/transcode">transcode</a></li>
<li><a href="/v3.1/func/type">type</a></li>
<li><a href="/v3.1/func/unsafeBitCast">unsafeBitCast</a></li>
<li><a href="/v3.1/func/unsafeDowncast">unsafeDowncast</a></li>
<li><a href="/v3.1/func/withExtendedLifetime">withExtendedLifetime</a></li>
<li><a href="/v3.1/func/withUnsafeBytes">withUnsafeBytes</a></li>
<li><a href="/v3.1/func/withUnsafeMutableBytes">withUnsafeMutableBytes</a></li>
<li><a href="/v3.1/func/withUnsafeMutablePointer">withUnsafeMutablePointer</a></li>
<li><a href="/v3.1/func/withUnsafePointer">withUnsafePointer</a></li>
<li><a href="/v3.1/func/withVaList">withVaList</a></li>
<li><a href="/v3.1/func/withoutActuallyEscaping">withoutActuallyEscaping</a></li>
<li><a href="/v3.1/func/zip">zip</a></li>
</ul>
</div>
</div>
Loading

0 comments on commit ea584b9

Please sign in to comment.