This repository has been archived by the owner on Nov 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
899 changed files
with
346,114 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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<T where T : SignedNumber>(<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<T where T : SignedNumber>(_ x: T) -> 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<T where T : FloatingPoint, T.Magnitude == T>(<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<T where T : FloatingPoint, T.Magnitude == T>(_ x: T) -> T</code> | ||
|
||
|
||
</div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>) -> Bool, _: @autoclosure (<wbr>) -> 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'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'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 () -> Bool, _ message: @autoclosure () -> String = default, file: StaticString = #file, line: UInt = #line)</code> | ||
|
||
|
||
</div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>) -> 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'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 () -> String = default, file: StaticString = #file, line: UInt = #line)</code> | ||
|
||
|
||
</div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("One two three four five") | ||
// Prints "One two three four five" | ||
|
||
debugPrint(1...5) | ||
// Prints "CountableClosedRange(1...5)" | ||
|
||
debugPrint(1.0, 2.0, 3.0, 4.0, 5.0) | ||
// Prints "1.0 2.0 3.0 4.0 5.0"</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: " ... ") | ||
// Prints "1.0 ... 2.0 ... 3.0 ... 4.0 ... 5.0"</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: "") | ||
} | ||
// Prints "12345"</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>" "</code>). | ||
<strong>terminator:</strong> The string to print after all items have been printed. The | ||
default is a newline (<code>"\n"</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<Target where Target : TextOutputStream>(<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 = "My range: " | ||
debugPrint(1...5, to: &range) | ||
// range == "My range: CountableClosedRange(1...5)\n"</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 = "" | ||
debugPrint(1.0, 2.0, 3.0, 4.0, 5.0, separator: " ... ", to: &separated) | ||
// separated == "1.0 ... 2.0 ... 3.0 ... 4.0 ... 5.0\n"</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 = "" | ||
for n in 1...5 { | ||
debugPrint(n, terminator: "", to: &numbers) | ||
} | ||
// numbers == "12345"</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>" "</code>). | ||
<strong>terminator:</strong> The string to print after all items have been printed. The | ||
default is a newline (<code>"\n"</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<Target where Target : TextOutputStream>(_ items: Any..., separator: String = default, terminator: String = default, to output: inout Target)</code> | ||
|
||
|
||
</div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'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<T>(<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's contents using its mirror to standard output.</p> | ||
|
||
<h4>Declaration</h4> | ||
<code class="language-swift">func dump<T>(_ value: T, name: String? = default, indent: Int = default, maxDepth: Int = default, maxItems: Int = default) -> 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<T, TargetStream where TargetStream : TextOutputStream>(<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's contents using its mirror to the specified output stream.</p> | ||
|
||
<h4>Declaration</h4> | ||
<code class="language-swift">func dump<T, TargetStream where TargetStream : TextOutputStream>(_ value: T, to target: inout TargetStream, name: String? = default, indent: Int = default, maxDepth: Int = default, maxItems: Int = default) -> T</code> | ||
|
||
|
||
</div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>) -> 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 () -> String = default, file: StaticString = #file, line: UInt = #line) -> Never</code> | ||
|
||
|
||
</div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) -> CVaListPointer</code> | ||
|
||
|
||
</div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.