blob: 9aaee6bb34d284204a3707ce4cfb7b6b99cd2bc4 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<title>Extensions Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script type="text/javascript">
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
</script>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body id="reference" class="Swift">
<a title="Extensions Reference"></a>
<header>
<div class="content-wrapper">
<p class="header-text"><a href="index.html">PredictionIO Swift SDK Docs</a> (96% documented)</p>
<p id="header-links"><a href="https://github.com/minhtule/PredictionIO-iOS-SDK"><img id="header-icon" src="img/gh.png" height="16px" width="16px" />View on GitHub</a></p>
</div>
</header>
<section id="valence">
<div class="content-wrapper">
<p id="hierarchial_navigation">
<a href="index.html" id="design_resources_link">PredictionIO Swift SDK Reference</a>
<img id="carat" src="img/carat.png" height="10px" width="6px" />
Extensions Reference
</p>
</div>
</section>
<div class="content-wrapper">
<nav class="book-parts">
<ul class="nav-parts">
<li class="part-name tasks">
<a href="Classes.html">Classes</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="Classes/BaseClient.html">BaseClient</a>
</li>
<li class="nav-chapter">
<a href="Classes/EngineClient.html">EngineClient</a>
</li>
<li class="nav-chapter">
<a href="Classes/EventClient.html">EventClient</a>
</li>
<li class="nav-chapter">
<a href="Classes.html#/s:C15PredictionIOSDK7Manager">Manager</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="Extensions.html">Extensions</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="Extensions/EventClient.html">EventClient</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="Structs.html">Structs</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="Structs/Event.html">Event</a>
</li>
</ul>
</li>
</ul>
</nav>
<div class="pixel-line"></div>
<div class="rubber-band-gap"></div>
<article class="chapter">
<a name="/"></a>
<h1 class="chapter-name">Extensions</h1>
<section>
<section class="section">
<p class="para">The following extensions are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<div class="task-name-container">
<hr/>
<a name="/URLStringConvertible"></a>
<a name="//apple_ref/swift/Section/URLStringConvertible" class="dashAnchor"></a>
<a href="#/URLStringConvertible">
<h3 class="section-name">URLStringConvertible</h3>
</a>
</div>
<ul class="task-group-list">
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:SS">
<a name="//apple_ref/swift/Extension/String" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:SS">String</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">An arbitrary Unicode string value.Unicode-Correct ===============Swift strings are designed to be Unicode-correct. In particular, the APIs make it easy to write code that works correctly, and does not surprise end-users, regardless of where you venture in the Unicode character space. For example,<ul><li>The <code>==</code> operator checks for Unicode canonical equivalence, so two different representations of the same string will always compare equal.</li><li>String elements are <code>Characters</code> (Unicode extended grapheme clusters), a unit of text that is meaningful to most humans.</li></ul>Locale-Insensitive ==================The fundamental operations on Swift strings are not sensitive to locale settings. That&rsquo;s because, for example, the validity of a <code>Dictionary&lt;String, T&gt;</code> in a running program depends on a given string comparison having a single, stable result. Therefore, Swift always uses the default, un-tailored Unicode algorithms for basic string operations.Importing <code>Foundation</code> endows swift strings with the full power of the <code>NSString</code> API, which allows you to choose more complex locale-sensitive operations explicitly.Value Semantics ===============Each string variable, <code>let</code> binding, or stored property has an independent value, so mutations to the string are not observable through its copies::<blockquote>var a = <q>foo</q> var b = a b[b.endIndex.predecessor()] = <q>x</q> println(<q>a=\(a), b=\(b)</q>) // a=foo, b=fox</blockquote>Strings use Copy-on-Write so that their data is only copied lazily, upon mutation, when more than one string instance is using the same buffer. Therefore, the first in any sequence of mutating operations may cost <code>O(N)</code> time and space, where <code>N</code> is the length of the string&rsquo;s (unspecified) underlying representation,.Growth and Capacity ===================When a string&rsquo;s contiguous storage fills up, new storage must be allocated and characters must be moved to the new storage. <code>String</code> uses an exponential growth strategy that makes <code>append</code> a constant time operation <em>when amortized over many invocations</em>.Objective-C Bridge ==================<code>String</code> is bridged to Objective-C as <code>NSString</code>, and a <code>String</code> that originated in Objective-C may store its characters in an <code>NSString</code>. Since any arbitrary subclass of <code>NSSString</code> can become a <code>String</code>, there are no guarantees about representation or efficiency in this case. Since <code>NSString</code> is immutable, it is just as though the storage was shared by some copy: the first in any sequence of mutating operations causes elements to be copied into unique, contiguous storage which may cost <code>O(N)</code> time and space, where <code>N</code> is the length of the string representation (or more, if the underlying <code>NSString</code> is has unusual performance characteristics).</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="Swift">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">struct</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/c:objc(cs)NSURLRequest">
<a name="//apple_ref/swift/Extension/NSURLRequest" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/c:objc(cs)NSURLRequest">NSURLRequest</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para"> An NSURLRequest object represents a URL load request in a manner independent of protocol and URL scheme. NSURLRequest encapsulates two basic data elements about a URL load request: <ul> <li>The URL to load. <li>The policy to use when consulting the URL content cache made available by the implementation. </ul> In addition, NSURLRequest is designed to be extended to support protocol-specific data by adding categories to access a property object provided in an interface targeted at protocol implementors. <ul> <li>Protocol implementors should direct their attention to the NSURLRequestExtensibility category on NSURLRequest for more information on how to provide extensions on NSURLRequest to support protocol-specific request information. <li>Clients of this API who wish to create NSURLRequest objects to load URL content should consult the protocol-specific NSURLRequest categories that are available. The NSHTTPURLRequest category on NSURLRequest is an example. </ul> <p> Objects of this class are used to create NSURLConnection instances, which can are used to perform the load of a URL, or as input to the NSURLConnection class method which performs synchronous loads.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="Swift">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="err">@interface</span> <span class="kt">NSURLRequest</span>
<span class="p">:</span> <span class="kt">NSObject</span> <span class="o">&lt;</span><span class="kt">NSSecureCoding</span><span class="p">,</span> <span class="kt">NSCopying</span><span class="p">,</span> <span class="kt">NSMutableCopying</span><span class="o">&gt;</span> <span class="p">{</span>
<span class="kt">NSURLRequestInternal</span> <span class="o">*</span><span class="n">_internal</span><span class="p">;</span>
<span class="p">}</span>
<span class="err">@end</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<hr/>
<a name="/Validation"></a>
<a name="//apple_ref/swift/Section/Validation" class="dashAnchor"></a>
<a href="#/Validation">
<h3 class="section-name">Validation</h3>
</a>
</div>
<ul class="task-group-list">
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:C15PredictionIOSDK7Request">
<a name="//apple_ref/swift/Extension/Request" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:C15PredictionIOSDK7Request">Request</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">Responsible for sending a request and receiving the response and associated data from the server, as well as managing its underlying <code>NSURLSessionTask</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="Swift">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">class</span> <span class="kt">Request</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<hr/>
<a name="/Upload"></a>
<a name="//apple_ref/swift/Section/Upload" class="dashAnchor"></a>
<a href="#/Upload">
<h3 class="section-name">Upload</h3>
</a>
</div>
<ul class="task-group-list">
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:C15PredictionIOSDK7Manager">
<a name="//apple_ref/swift/Extension/Manager" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:C15PredictionIOSDK7Manager">Manager</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">Responsible for creating and managing <code>Request</code> objects, as well as their underlying <code>NSURLSession</code>.When finished with a manager, be sure to call either <code>session.finishTasksAndInvalidate()</code> or <code>session.invalidateAndCancel()</code> before deinitialization.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="Swift">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Manager</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<hr/>
<a name="/Convenience%20Methods"></a>
<a name="//apple_ref/swift/Section/Convenience Methods" class="dashAnchor"></a>
<a href="#/Convenience%20Methods">
<h3 class="section-name">Convenience Methods</h3>
</a>
</div>
<ul class="task-group-list">
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:C15PredictionIOSDK11EventClient">
<a name="//apple_ref/swift/Extension/EventClient" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:C15PredictionIOSDK11EventClient">EventClient</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">Client for sending data to PredictionIO Event Server.</p>
<a href="Extensions/EventClient.html" class="see-more">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="Swift">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">EventClient</span> <span class="p">:</span> <span class="kt">BaseClient</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p class="copyright">&copy; 2015 <a class="link" href="https://github.com/minhtule" target="_blank" rel="external">Minh-Tu Le</a>. All rights reserved. (Last updated: 2015-03-03)</p>
<p class="copyright">Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.1.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>