spec/integration_specs/document_alamofire/after/docs/index.html in jazzy-0.0.15 vs spec/integration_specs/document_alamofire/after/docs/index.html in jazzy-0.0.16
- old
+ new
@@ -1,12 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Alamofire Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
- <link rel="stylesheet" type="text/css" href="css/github_syntax_highlighting.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="Alamofire Reference"></a>
@@ -205,16 +216,16 @@
</ol>
<hr>
<a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='usage'>Usage</h2>
<a href='#making_a_request' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='making_a_request'>Making a Request</h3>
-<pre><code class="highlight swift"><span class="kd">import</span> <span class="kt">Alamofire</span>
+<pre class="highlight swift"><code><span class="kd">import</span> <span class="kt">Alamofire</span>
<span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
</code></pre>
<a href='#response_handling' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='response_handling'>Response Handling</h3>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">])</span>
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">])</span>
<span class="o">.</span><span class="n">response</span> <span class="p">{</span> <span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">response</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">error</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
<span class="nf">println</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
<span class="nf">println</span><span class="p">(</span><span class="n">error</span><span class="p">)</span>
<span class="p">}</span>
@@ -229,32 +240,32 @@
<li><code>responseString(encoding: NSStringEncoding)</code></li>
<li><code>responseJSON(options: NSJSONReadingOptions)</code></li>
<li><code>responsePropertyList(options: NSPropertyListReadOptions)</code></li>
</ul>
<a href='#response_string_handler' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='response_string_handler'>Response String Handler</h4>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
<span class="o">.</span><span class="n">responseString</span> <span class="p">{</span> <span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">string</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#response_json_handler' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='response_json_handler'>Response JSON Handler</h4>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
<span class="o">.</span><span class="n">responseJSON</span> <span class="p">{</span> <span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="kt">JSON</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="kt">JSON</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#chained_response_handlers' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='chained_response_handlers'>Chained Response Handlers</h4>
-<p class="para">Response handlers can even be chained:</p><pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
+<p class="para">Response handlers can even be chained:</p><pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
<span class="o">.</span><span class="n">responseString</span> <span class="p">{</span> <span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">string</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
<span class="p">}</span>
<span class="o">.</span><span class="n">responseJSON</span> <span class="p">{</span> <span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="kt">JSON</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="kt">JSON</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#http_methods' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='http_methods'>HTTP Methods</h3>
-<p class="para"><code>Alamofire.Method</code> lists the HTTP methods defined in <a href="http://tools.ietf.org/html/rfc7231#section-4.3">RFC 7231 §4.3</a>:</p><pre><code class="highlight swift"><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Method</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span>
+<p class="para"><code>Alamofire.Method</code> lists the HTTP methods defined in <a href="http://tools.ietf.org/html/rfc7231#section-4.3">RFC 7231 §4.3</a>:</p><pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Method</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span>
<span class="k">case</span> <span class="kt">OPTIONS</span> <span class="o">=</span> <span class="s">"OPTIONS"</span>
<span class="k">case</span> <span class="kt">GET</span> <span class="o">=</span> <span class="s">"GET"</span>
<span class="k">case</span> <span class="kt">HEAD</span> <span class="o">=</span> <span class="s">"HEAD"</span>
<span class="k">case</span> <span class="kt">POST</span> <span class="o">=</span> <span class="s">"POST"</span>
<span class="k">case</span> <span class="kt">PUT</span> <span class="o">=</span> <span class="s">"PUT"</span>
@@ -262,23 +273,23 @@
<span class="k">case</span> <span class="kt">DELETE</span> <span class="o">=</span> <span class="s">"DELETE"</span>
<span class="k">case</span> <span class="kt">TRACE</span> <span class="o">=</span> <span class="s">"TRACE"</span>
<span class="k">case</span> <span class="kt">CONNECT</span> <span class="o">=</span> <span class="s">"CONNECT"</span>
<span class="p">}</span>
</code></pre>
-<p class="para">These values can be passed as the first argument of the <code>Alamofire.request</code> method:</p><pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">POST</span><span class="p">,</span> <span class="s">"http://httpbin.org/post"</span><span class="p">)</span>
+<p class="para">These values can be passed as the first argument of the <code>Alamofire.request</code> method:</p><pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">POST</span><span class="p">,</span> <span class="s">"http://httpbin.org/post"</span><span class="p">)</span>
<span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">PUT</span><span class="p">,</span> <span class="s">"http://httpbin.org/put"</span><span class="p">)</span>
<span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">DELETE</span><span class="p">,</span> <span class="s">"http://httpbin.org/delete"</span><span class="p">)</span>
</code></pre>
<a href='#parameters' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='parameters'>Parameters</h3>
<a href='#get_request_with_url_encoded_parameters' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='get_request_with_url_encoded_parameters'>GET Request With URL-Encoded Parameters</h4>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">])</span>
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">])</span>
<span class="c1">// http://httpbin.org/get?foo=bar
</span></code></pre>
<a href='#post_request_with_url_encoded_parameters' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='post_request_with_url_encoded_parameters'>POST Request With URL-Encoded Parameters</h4>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">parameters</span> <span class="o">=</span> <span class="p">[</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">parameters</span> <span class="o">=</span> <span class="p">[</span>
<span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">,</span>
<span class="s">"baz"</span><span class="p">:</span> <span class="p">[</span><span class="s">"a"</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span>
<span class="s">"qux"</span><span class="p">:</span> <span class="p">[</span>
<span class="s">"x"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
<span class="s">"y"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
@@ -288,11 +299,11 @@
<span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">POST</span><span class="p">,</span> <span class="s">"http://httpbin.org/post"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="n">parameters</span><span class="p">)</span>
<span class="c1">// HTTP body: foo=bar&baz[]=a&baz[]=1&qux[x]=1&qux[y]=2&qux[z]=3
</span></code></pre>
<a href='#parameter_encoding' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='parameter_encoding'>Parameter Encoding</h3>
-<p class="para">Parameters can also be encoded as JSON, Property List, or any custom format, using the <code>ParameterEncoding</code> enum:</p><pre><code class="highlight swift"><span class="kd">enum</span> <span class="kt">ParameterEncoding</span> <span class="p">{</span>
+<p class="para">Parameters can also be encoded as JSON, Property List, or any custom format, using the <code>ParameterEncoding</code> enum:</p><pre class="highlight swift"><code><span class="kd">enum</span> <span class="kt">ParameterEncoding</span> <span class="p">{</span>
<span class="k">case</span> <span class="kt">URL</span>
<span class="k">case</span> <span class="kt">JSON</span>
<span class="k">case</span> <span class="kt">PropertyList</span><span class="p">(</span><span class="nv">format</span><span class="p">:</span> <span class="kt">NSPropertyListFormat</span><span class="p">,</span>
<span class="nv">options</span><span class="p">:</span> <span class="kt">NSPropertyListWriteOptions</span><span class="p">)</span>
@@ -308,19 +319,19 @@
<li><code>JSON</code>: Uses <code>NSJSONSerialization</code> to create a JSON representation of the parameters object, which is set as the body of the request. The <code>Content-Type</code> HTTP header field of an encoded request is set to <code>application/json</code>.</li>
<li><code>PropertyList</code>: Uses <code>NSPropertyListSerialization</code> to create a plist representation of the parameters object, according to the associated format and write options values, which is set as the body of the request. The <code>Content-Type</code> HTTP header field of an encoded request is set to <code>application/x-plist</code>.</li>
<li><code>Custom</code>: Uses the associated closure value to construct a new request given an existing request and parameters.</li>
</ul>
<a href='#manual_parameter_encoding_of_an_nsurlrequest' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='manual_parameter_encoding_of_an_nsurlrequest'>Manual Parameter Encoding of an NSURLRequest</h4>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">URL</span> <span class="o">=</span> <span class="kt">NSURL</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">URL</span> <span class="o">=</span> <span class="kt">NSURL</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
<span class="k">var</span> <span class="nv">request</span> <span class="o">=</span> <span class="kt">NSURLRequest</span><span class="p">(</span><span class="kt">URL</span><span class="p">:</span> <span class="kt">URL</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">parameters</span> <span class="o">=</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">]</span>
<span class="k">let</span> <span class="nv">encoding</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">ParameterEncoding</span><span class="o">.</span><span class="kt">URL</span>
<span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">=</span> <span class="n">encoding</span><span class="o">.</span><span class="nf">encode</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">parameters</span><span class="p">)</span>
</code></pre>
<a href='#post_request_with_json_encoded_parameters' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='post_request_with_json_encoded_parameters'>POST Request with JSON-encoded Parameters</h4>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">parameters</span> <span class="o">=</span> <span class="p">[</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">parameters</span> <span class="o">=</span> <span class="p">[</span>
<span class="s">"foo"</span><span class="p">:</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">],</span>
<span class="s">"bar"</span><span class="p">:</span> <span class="p">[</span>
<span class="s">"baz"</span><span class="p">:</span> <span class="s">"qux"</span>
<span class="p">]</span>
<span class="p">]</span>
@@ -335,18 +346,18 @@
<li>File</li>
<li>Data</li>
<li>Stream</li>
</ul>
<a href='#uploading_a_file' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='uploading_a_file'>Uploading a File</h4>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">fileURL</span> <span class="o">=</span> <span class="kt">NSBundle</span><span class="o">.</span><span class="nf">mainBundle</span><span class="p">()</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">fileURL</span> <span class="o">=</span> <span class="kt">NSBundle</span><span class="o">.</span><span class="nf">mainBundle</span><span class="p">()</span>
<span class="o">.</span><span class="kt">URLForResource</span><span class="p">(</span><span class="s">"Default"</span><span class="p">,</span>
<span class="nv">withExtension</span><span class="p">:</span> <span class="s">"png"</span><span class="p">)</span>
<span class="kt">Alamofire</span><span class="o">.</span><span class="nf">upload</span><span class="p">(</span><span class="o">.</span><span class="kt">POST</span><span class="p">,</span> <span class="s">"http://httpbin.org/post"</span><span class="p">,</span> <span class="nv">file</span><span class="p">:</span> <span class="n">fileURL</span><span class="p">)</span>
</code></pre>
<a href='#uploading_w_progress' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='uploading_w_progress'>Uploading w/Progress</h4>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">upload</span><span class="p">(</span><span class="o">.</span><span class="kt">POST</span><span class="p">,</span> <span class="s">"http://httpbin.org/post"</span><span class="p">,</span> <span class="nv">file</span><span class="p">:</span> <span class="n">fileURL</span><span class="p">)</span>
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">upload</span><span class="p">(</span><span class="o">.</span><span class="kt">POST</span><span class="p">,</span> <span class="s">"http://httpbin.org/post"</span><span class="p">,</span> <span class="nv">file</span><span class="p">:</span> <span class="n">fileURL</span><span class="p">)</span>
<span class="o">.</span><span class="n">progress</span> <span class="p">{</span> <span class="p">(</span><span class="n">bytesWritten</span><span class="p">,</span> <span class="n">totalBytesWritten</span><span class="p">,</span> <span class="n">totalBytesExpectedToWrite</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="n">totalBytesWritten</span><span class="p">)</span>
<span class="p">}</span>
<span class="o">.</span><span class="n">responseJSON</span> <span class="p">{</span> <span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">response</span><span class="p">,</span> <span class="kt">JSON</span><span class="p">,</span> <span class="n">error</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="kt">JSON</span><span class="p">)</span>
@@ -357,11 +368,11 @@
<ul>
<li>Request</li>
<li>Resume Data</li>
</ul>
<a href='#downloading_a_file' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='downloading_a_file'>Downloading a File</h4>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">download</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/stream/100"</span><span class="p">,</span> <span class="nv">destination</span><span class="p">:</span> <span class="p">{</span> <span class="p">(</span><span class="n">temporaryURL</span><span class="p">,</span> <span class="n">response</span><span class="p">)</span> <span class="k">in</span>
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">download</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/stream/100"</span><span class="p">,</span> <span class="nv">destination</span><span class="p">:</span> <span class="p">{</span> <span class="p">(</span><span class="n">temporaryURL</span><span class="p">,</span> <span class="n">response</span><span class="p">)</span> <span class="k">in</span>
<span class="k">if</span> <span class="k">let</span> <span class="nv">directoryURL</span> <span class="o">=</span> <span class="kt">NSFileManager</span><span class="o">.</span><span class="nf">defaultManager</span><span class="p">()</span>
<span class="o">.</span><span class="kt">URLsForDirectory</span><span class="p">(</span><span class="o">.</span><span class="kt">DocumentDirectory</span><span class="p">,</span>
<span class="nv">inDomains</span><span class="p">:</span> <span class="o">.</span><span class="kt">UserDomainMask</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">as</span><span class="p">?</span> <span class="kt">NSURL</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">pathComponent</span> <span class="o">=</span> <span class="n">response</span><span class="o">.</span><span class="n">suggestedFilename</span>
@@ -371,16 +382,16 @@
<span class="k">return</span> <span class="n">temporaryURL</span>
<span class="p">})</span>
</code></pre>
<a href='#using_the_default_download_destination' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='using_the_default_download_destination'>Using the Default Download Destination</h4>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">destination</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Request</span><span class="o">.</span><span class="nf">suggestedDownloadDestination</span><span class="p">(</span><span class="nv">directory</span><span class="p">:</span> <span class="o">.</span><span class="kt">DocumentDirectory</span><span class="p">,</span> <span class="nv">domain</span><span class="p">:</span> <span class="o">.</span><span class="kt">UserDomainMask</span><span class="p">)</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">destination</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Request</span><span class="o">.</span><span class="nf">suggestedDownloadDestination</span><span class="p">(</span><span class="nv">directory</span><span class="p">:</span> <span class="o">.</span><span class="kt">DocumentDirectory</span><span class="p">,</span> <span class="nv">domain</span><span class="p">:</span> <span class="o">.</span><span class="kt">UserDomainMask</span><span class="p">)</span>
<span class="kt">Alamofire</span><span class="o">.</span><span class="nf">download</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/stream/100"</span><span class="p">,</span> <span class="nv">destination</span><span class="p">:</span> <span class="n">destination</span><span class="p">)</span>
</code></pre>
<a href='#downloading_a_file_w_progress' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='downloading_a_file_w_progress'>Downloading a File w/Progress</h4>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">download</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/stream/100"</span><span class="p">,</span> <span class="nv">destination</span><span class="p">:</span> <span class="n">destination</span><span class="p">)</span>
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">download</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/stream/100"</span><span class="p">,</span> <span class="nv">destination</span><span class="p">:</span> <span class="n">destination</span><span class="p">)</span>
<span class="o">.</span><span class="n">progress</span> <span class="p">{</span> <span class="p">(</span><span class="n">bytesRead</span><span class="p">,</span> <span class="n">totalBytesRead</span><span class="p">,</span> <span class="n">totalBytesExpectedToRead</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="n">totalBytesRead</span><span class="p">)</span>
<span class="p">}</span>
<span class="o">.</span><span class="n">response</span> <span class="p">{</span> <span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">response</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">error</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
@@ -393,21 +404,21 @@
<li><a href="http://en.wikipedia.org/wiki/Digest_access_authentication">HTTP Digest</a></li>
<li><a href="http://en.wikipedia.org/wiki/Kerberos_%28protocol%29">Kerberos</a></li>
<li><a href="http://en.wikipedia.org/wiki/NT_LAN_Manager">NTLM</a></li>
</ul>
<a href='#http_basic_authentication' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='http_basic_authentication'>HTTP Basic Authentication</h4>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">user</span> <span class="o">=</span> <span class="s">"user"</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">user</span> <span class="o">=</span> <span class="s">"user"</span>
<span class="k">let</span> <span class="nv">password</span> <span class="o">=</span> <span class="s">"password"</span>
<span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"https://httpbin.org/basic-auth/</span><span class="se">\(</span><span class="n">user</span><span class="se">)</span><span class="s">/</span><span class="se">\(</span><span class="n">password</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
<span class="o">.</span><span class="nf">authenticate</span><span class="p">(</span><span class="nv">user</span><span class="p">:</span> <span class="n">user</span><span class="p">,</span> <span class="nv">password</span><span class="p">:</span> <span class="n">password</span><span class="p">)</span>
<span class="o">.</span><span class="n">response</span> <span class="p">{(</span><span class="n">request</span><span class="p">,</span> <span class="n">response</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">error</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#authentication_with_nsurlcredential' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='authentication_with_nsurlcredential'>Authentication with NSURLCredential</h4>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">user</span> <span class="o">=</span> <span class="s">"user"</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">user</span> <span class="o">=</span> <span class="s">"user"</span>
<span class="k">let</span> <span class="nv">password</span> <span class="o">=</span> <span class="s">"password"</span>
<span class="k">let</span> <span class="nv">credential</span> <span class="o">=</span> <span class="kt">NSURLCredential</span><span class="p">(</span><span class="nv">user</span><span class="p">:</span> <span class="n">user</span><span class="p">,</span> <span class="nv">password</span><span class="p">:</span> <span class="n">password</span><span class="p">,</span> <span class="nv">persistence</span><span class="p">:</span> <span class="o">.</span><span class="kt">ForSession</span><span class="p">)</span>
<span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"https://httpbin.org/basic-auth/</span><span class="se">\(</span><span class="n">user</span><span class="se">)</span><span class="s">/</span><span class="se">\(</span><span class="n">password</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
@@ -416,37 +427,37 @@
<span class="nf">println</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#validation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='validation'>Validation</h3>
<p class="para">By default, Alamofire treats any completed request to be successful, regardless of the content of the response. Calling <code>validate</code> before a response handler causes an error to be generated if the response had an unacceptable status code or MIME type.</p><a href='#manual_validation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='manual_validation'>Manual Validation</h4>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">])</span>
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">])</span>
<span class="o">.</span><span class="nf">validate</span><span class="p">(</span><span class="nv">statusCode</span><span class="p">:</span> <span class="mi">200</span><span class="o">..<</span><span class="mi">300</span><span class="p">)</span>
<span class="o">.</span><span class="nf">validate</span><span class="p">(</span><span class="nv">contentType</span><span class="p">:</span> <span class="p">[</span><span class="s">"application/json"</span><span class="p">])</span>
<span class="o">.</span><span class="n">response</span> <span class="p">{</span> <span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">error</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="n">error</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#automatic_validation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='automatic_validation'>Automatic Validation</h4>
-<p class="para">Automatically validates status code within <code>200...299</code> range, and that the <code>Content-Type</code> header of the response matches the <code>Accept</code> header of the request, if one is provided.</p><pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">])</span>
+<p class="para">Automatically validates status code within <code>200...299</code> range, and that the <code>Content-Type</code> header of the response matches the <code>Accept</code> header of the request, if one is provided.</p><pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">])</span>
<span class="o">.</span><span class="nf">validate</span><span class="p">()</span>
<span class="o">.</span><span class="n">response</span> <span class="p">{</span> <span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">error</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="n">error</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href='#printable' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='printable'>Printable</h3>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">request</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/ip"</span><span class="p">)</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">request</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/ip"</span><span class="p">)</span>
<span class="nf">println</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
<span class="c1">// GET http://httpbin.org/ip (200)
</span></code></pre>
<a href='#debugprintable' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='debugprintable'>DebugPrintable</h3>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">request</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">])</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">request</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">])</span>
<span class="nf">debugPrintln</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
</code></pre>
<a href='#output_curl' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='output_curl'>Output (cURL)</h4>
-<pre><code class="highlight plaintext">$ curl -i \
+<pre class="highlight plaintext"><code>$ curl -i \
-H "User-Agent: Alamofire" \
-H "Accept-Encoding: Accept-Encoding: gzip;q=1.0,compress;q=0.5" \
-H "Accept-Language: en;q=1.0,fr;q=0.9,de;q=0.8,zh-Hans;q=0.7,zh-Hant;q=0.6,ja;q=0.5" \
"http://httpbin.org/get?foo=bar"
</code></pre>
@@ -463,29 +474,29 @@
<li><a href="https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/Introduction/Introduction.html#//apple_ref/occ/cl/NSURLSession">NSURLSession Class Reference</a></li>
<li><a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURLCache_Class/Reference/Reference.html#//apple_ref/occ/cl/NSURLCache">NSURLCache Class Reference</a></li>
<li><a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURLAuthenticationChallenge_Class/Reference/Reference.html">NSURLAuthenticationChallenge Class Reference</a></li>
</ul>
<a href='#manager' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='manager'>Manager</h3>
-<p class="para">Top-level convenience methods like <code>Alamofire.request</code> use a shared instance of <code>Alamofire.Manager</code>, which is configured with the default <code>NSURLSessionConfiguration</code>.</p><p class="para">As such, the following two statements are equivalent:</p><pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
+<p class="para">Top-level convenience methods like <code>Alamofire.request</code> use a shared instance of <code>Alamofire.Manager</code>, which is configured with the default <code>NSURLSessionConfiguration</code>.</p><p class="para">As such, the following two statements are equivalent:</p><pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)</span>
</code></pre>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">manager</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Manager</span><span class="o">.</span><span class="n">sharedInstance</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">manager</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Manager</span><span class="o">.</span><span class="n">sharedInstance</span>
<span class="n">manager</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="kt">NSURLRequest</span><span class="p">(</span><span class="kt">URL</span><span class="p">:</span> <span class="kt">NSURL</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="s">"http://httpbin.org/get"</span><span class="p">)))</span>
</code></pre>
<p class="para">Applications can create managers for background and ephemeral sessions, as well as new managers that customize the default session configuration, such as for default headers (<code>HTTPAdditionalHeaders</code>) or timeout interval (<code>timeoutIntervalForRequest</code>).</p><a href='#creating_a_manager_with_default_configuration' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='creating_a_manager_with_default_configuration'>Creating a Manager with Default Configuration</h4>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">configuration</span> <span class="o">=</span> <span class="kt">NSURLSessionConfiguration</span><span class="o">.</span><span class="nf">defaultSessionConfiguration</span><span class="p">()</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">configuration</span> <span class="o">=</span> <span class="kt">NSURLSessionConfiguration</span><span class="o">.</span><span class="nf">defaultSessionConfiguration</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">manager</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Manager</span><span class="p">(</span><span class="nv">configuration</span><span class="p">:</span> <span class="n">configuration</span><span class="p">)</span>
</code></pre>
<a href='#creating_a_manager_with_background_configuration' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='creating_a_manager_with_background_configuration'>Creating a Manager with Background Configuration</h4>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">configuration</span> <span class="o">=</span> <span class="kt">NSURLSessionConfiguration</span><span class="o">.</span><span class="nf">backgroundSessionConfiguration</span><span class="p">(</span><span class="s">"com.example.app.background"</span><span class="p">)</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">configuration</span> <span class="o">=</span> <span class="kt">NSURLSessionConfiguration</span><span class="o">.</span><span class="nf">backgroundSessionConfiguration</span><span class="p">(</span><span class="s">"com.example.app.background"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">manager</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Manager</span><span class="p">(</span><span class="nv">configuration</span><span class="p">:</span> <span class="n">configuration</span><span class="p">)</span>
</code></pre>
<a href='#creating_a_manager_with_ephemeral_configuration' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='creating_a_manager_with_ephemeral_configuration'>Creating a Manager with Ephemeral Configuration</h4>
-<pre><code class="highlight swift"><span class="k">let</span> <span class="nv">configuration</span> <span class="o">=</span> <span class="kt">NSURLSessionConfiguration</span><span class="o">.</span><span class="nf">ephemeralSessionConfiguration</span><span class="p">()</span>
+<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">configuration</span> <span class="o">=</span> <span class="kt">NSURLSessionConfiguration</span><span class="o">.</span><span class="nf">ephemeralSessionConfiguration</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">manager</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Manager</span><span class="p">(</span><span class="nv">configuration</span><span class="p">:</span> <span class="n">configuration</span><span class="p">)</span>
</code></pre>
<a href='#modifying_session_configuration' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='modifying_session_configuration'>Modifying Session Configuration</h4>
-<pre><code class="highlight swift"><span class="k">var</span> <span class="nv">defaultHeaders</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Manager</span><span class="o">.</span><span class="n">sharedInstance</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">configuration</span><span class="o">.</span><span class="kt">HTTPAdditionalHeaders</span> <span class="p">??</span> <span class="p">[:]</span>
+<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">defaultHeaders</span> <span class="o">=</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Manager</span><span class="o">.</span><span class="n">sharedInstance</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">configuration</span><span class="o">.</span><span class="kt">HTTPAdditionalHeaders</span> <span class="p">??</span> <span class="p">[:]</span>
<span class="n">defaultHeaders</span><span class="p">[</span><span class="s">"DNT"</span><span class="p">]</span> <span class="o">=</span> <span class="s">"1 (Do Not Track Enabled)"</span>
<span class="k">let</span> <span class="nv">configuration</span> <span class="o">=</span> <span class="kt">NSURLSessionConfiguration</span><span class="o">.</span><span class="nf">defaultSessionConfiguration</span><span class="p">()</span>
<span class="n">configuration</span><span class="o">.</span><span class="kt">HTTPAdditionalHeaders</span> <span class="o">=</span> <span class="n">defaultHeaders</span>
@@ -501,11 +512,11 @@
<li><code>resume()</code>: Resumes the underlying task and dispatch queue. If the owning manager does not have <code>startRequestsImmediately</code> set to <code>true</code>, the request must call <code>resume()</code> in order to start.</li>
<li><code>cancel()</code>: Cancels the underlying task, producing an error that is passed to any registered response handlers.</li>
</ul>
<a href='#response_serialization' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='response_serialization'>Response Serialization</h3>
<a href='#creating_a_custom_response_serializer' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='creating_a_custom_response_serializer'>Creating a Custom Response Serializer</h4>
-<p class="para">Alamofire provides built-in response serialization for strings, JSON, and property lists, but others can be added in extensions on <code>Alamofire.Request</code>.</p><p class="para">For example, here’s how a response handler using <a href="https://github.com/mattt/Ono">Ono</a> might be implemented:</p><pre><code class="highlight swift"><span class="kd">extension</span> <span class="kt">Request</span> <span class="p">{</span>
+<p class="para">Alamofire provides built-in response serialization for strings, JSON, and property lists, but others can be added in extensions on <code>Alamofire.Request</code>.</p><p class="para">For example, here’s how a response handler using <a href="https://github.com/mattt/Ono">Ono</a> might be implemented:</p><pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Request</span> <span class="p">{</span>
<span class="kd">class</span> <span class="kd">func</span> <span class="kt">XMLResponseSerializer</span><span class="p">()</span> <span class="o">-></span> <span class="kt">Serializer</span> <span class="p">{</span>
<span class="k">return</span> <span class="p">{</span> <span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">response</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span> <span class="k">in</span>
<span class="k">if</span> <span class="n">data</span> <span class="o">==</span> <span class="kc">nil</span> <span class="p">{</span>
<span class="nf">return</span> <span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="kc">nil</span><span class="p">)</span>
<span class="p">}</span>
@@ -523,11 +534,11 @@
<span class="p">})</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<a href='#generic_response_object_serialization' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='generic_response_object_serialization'>Generic Response Object Serialization</h4>
-<p class="para">Generics can be used to provide automatic, type-safe response object serialization.</p><pre><code class="highlight swift"><span class="k">@objc</span> <span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">ResponseObjectSerializable</span> <span class="p">{</span>
+<p class="para">Generics can be used to provide automatic, type-safe response object serialization.</p><pre class="highlight swift"><code><span class="k">@objc</span> <span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">ResponseObjectSerializable</span> <span class="p">{</span>
<span class="nf">init</span><span class="p">(</span><span class="nv">response</span><span class="p">:</span> <span class="kt">NSHTTPURLResponse</span><span class="p">,</span> <span class="nv">representation</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">)</span>
<span class="p">}</span>
<span class="kd">extension</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Request</span> <span class="p">{</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="n">responseObject</span><span class="o"><</span><span class="kt">T</span><span class="p">:</span> <span class="kt">ResponseObjectSerializable</span><span class="o">></span><span class="p">(</span><span class="nv">completionHandler</span><span class="p">:</span> <span class="p">(</span><span class="kt">NSURLRequest</span><span class="p">,</span> <span class="kt">NSHTTPURLResponse</span><span class="p">?,</span> <span class="kt">T</span><span class="p">?,</span> <span class="kt">NSError</span><span class="p">?)</span> <span class="o">-></span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-></span> <span class="k">Self</span> <span class="p">{</span>
@@ -545,26 +556,26 @@
<span class="nf">completionHandler</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">response</span><span class="p">,</span> <span class="n">object</span> <span class="k">as</span><span class="p">?</span> <span class="kt">T</span><span class="p">,</span> <span class="n">error</span><span class="p">)</span>
<span class="p">})</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
-<pre><code class="highlight swift"><span class="kd">final</span> <span class="kd">class</span> <span class="kt">User</span><span class="p">:</span> <span class="kt">ResponseObjectSerializable</span> <span class="p">{</span>
+<pre class="highlight swift"><code><span class="kd">final</span> <span class="kd">class</span> <span class="kt">User</span><span class="p">:</span> <span class="kt">ResponseObjectSerializable</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">username</span><span class="p">:</span> <span class="kt">String</span>
<span class="k">let</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span>
<span class="kd">required</span> <span class="nf">init</span><span class="p">(</span><span class="nv">response</span><span class="p">:</span> <span class="kt">NSHTTPURLResponse</span><span class="p">,</span> <span class="nv">representation</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">)</span> <span class="p">{</span>
<span class="k">self</span><span class="o">.</span><span class="n">username</span> <span class="o">=</span> <span class="n">response</span><span class="o">.</span><span class="kt">URL</span><span class="o">!.</span><span class="n">lastPathComponent</span>
<span class="k">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">representation</span><span class="o">.</span><span class="nf">valueForKeyPath</span><span class="p">(</span><span class="s">"name"</span><span class="p">)</span> <span class="k">as</span> <span class="kt">String</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://example.com/users/mattt"</span><span class="p">)</span>
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="s">"http://example.com/users/mattt"</span><span class="p">)</span>
<span class="o">.</span><span class="n">responseObject</span> <span class="p">{</span> <span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="nv">user</span><span class="p">:</span> <span class="kt">User</span><span class="p">?,</span> <span class="n">_</span><span class="p">)</span> <span class="k">in</span>
<span class="nf">println</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
-<p class="para">The same approach can also be used to handle endpoints that return a representation of a collection of objects:</p><pre><code class="highlight swift"><span class="k">@objc</span> <span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">ResponseCollectionSerializable</span> <span class="p">{</span>
+<p class="para">The same approach can also be used to handle endpoints that return a representation of a collection of objects:</p><pre class="highlight swift"><code><span class="k">@objc</span> <span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">ResponseCollectionSerializable</span> <span class="p">{</span>
<span class="kd">class</span> <span class="kd">func</span> <span class="nf">collection</span><span class="p">(</span><span class="nv">#response</span><span class="p">:</span> <span class="kt">NSHTTPURLResponse</span><span class="p">,</span> <span class="nv">representation</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">)</span> <span class="o">-></span> <span class="p">[</span><span class="k">Self</span><span class="p">]</span>
<span class="p">}</span>
<span class="kd">extension</span> <span class="kt">Alamofire</span><span class="o">.</span><span class="kt">Request</span> <span class="p">{</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="n">responseCollection</span><span class="o"><</span><span class="kt">T</span><span class="p">:</span> <span class="kt">ResponseCollectionSerializable</span><span class="o">></span><span class="p">(</span><span class="nv">completionHandler</span><span class="p">:</span> <span class="p">(</span><span class="kt">NSURLRequest</span><span class="p">,</span> <span class="kt">NSHTTPURLResponse</span><span class="p">?,</span> <span class="p">[</span><span class="kt">T</span><span class="p">]?,</span> <span class="kt">NSError</span><span class="p">?)</span> <span class="o">-></span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-></span> <span class="k">Self</span> <span class="p">{</span>
@@ -584,11 +595,11 @@
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<a href='#urlstringconvertible' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='urlstringconvertible'>URLStringConvertible</h3>
<p class="para">Types adopting the <code>URLStringConvertible</code> protocol can be used to construct URL strings, which are then used to construct URL requests. Top-level convenience methods taking a <code>URLStringConvertible</code> argument are provided to allow for type-safe routing behavior.</p><p class="para">Applications interacting with web applications in a significant manner are encouraged to adopt either <code>URLStringConvertible</code> or <code>URLRequestConvertible</code> as a way to ensure consistency of requested endpoints.</p><a href='#type_safe_routing' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='type_safe_routing'>Type-Safe Routing</h4>
-<pre><code class="highlight swift"><span class="kd">enum</span> <span class="kt">Router</span><span class="p">:</span> <span class="kt">URLStringConvertible</span> <span class="p">{</span>
+<pre class="highlight swift"><code><span class="kd">enum</span> <span class="kt">Router</span><span class="p">:</span> <span class="kt">URLStringConvertible</span> <span class="p">{</span>
<span class="kd">static</span> <span class="k">let</span> <span class="nv">baseURLString</span> <span class="o">=</span> <span class="s">"http://example.com"</span>
<span class="k">case</span> <span class="kt">Root</span>
<span class="k">case</span> <span class="kt">User</span><span class="p">(</span><span class="kt">String</span><span class="p">)</span>
<span class="k">case</span> <span class="kt">Post</span><span class="p">(</span><span class="kt">Int</span><span class="p">,</span> <span class="kt">Int</span><span class="p">,</span> <span class="kt">String</span><span class="p">)</span>
@@ -610,15 +621,15 @@
<span class="k">return</span> <span class="kt">Router</span><span class="o">.</span><span class="n">baseURLString</span> <span class="o">+</span> <span class="n">path</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="kt">Router</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="s">"mattt"</span><span class="p">))</span>
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="o">.</span><span class="kt">GET</span><span class="p">,</span> <span class="kt">Router</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="s">"mattt"</span><span class="p">))</span>
</code></pre>
<a href='#urlrequestconvertible' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='urlrequestconvertible'>URLRequestConvertible</h3>
<p class="para">Types adopting the <code>URLRequestConvertible</code> protocol can be used to construct URL requests. Like <code>URLStringConvertible</code>, this is recommended for applications with any significant interactions between client and server.</p><p class="para">Top-level and instance methods on <code>Manager</code> taking <code>URLRequestConvertible</code> arguments are provided as a way to provide type-safe routing. Such an approach can be used to abstract away server-side inconsistencies, as well as manage authentication credentials and other state.</p><a href='#api_parameter_abstraction' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='api_parameter_abstraction'>API Parameter Abstraction</h4>
-<pre><code class="highlight swift"><span class="kd">enum</span> <span class="kt">Router</span><span class="p">:</span> <span class="kt">URLRequestConvertible</span> <span class="p">{</span>
+<pre class="highlight swift"><code><span class="kd">enum</span> <span class="kt">Router</span><span class="p">:</span> <span class="kt">URLRequestConvertible</span> <span class="p">{</span>
<span class="kd">static</span> <span class="k">let</span> <span class="nv">baseURLString</span> <span class="o">=</span> <span class="s">"http://example.com"</span>
<span class="kd">static</span> <span class="k">let</span> <span class="nv">perPage</span> <span class="o">=</span> <span class="mi">50</span>
<span class="k">case</span> <span class="kt">Search</span><span class="p">(</span><span class="nv">query</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">page</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span>
@@ -640,14 +651,14 @@
<span class="k">return</span> <span class="n">encoding</span><span class="o">.</span><span class="nf">encode</span><span class="p">(</span><span class="kt">URLRequest</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="n">parameters</span><span class="p">)</span><span class="o">.</span><span class="mi">0</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="kt">Router</span><span class="o">.</span><span class="kt">Search</span><span class="p">(</span><span class="nv">query</span><span class="p">:</span> <span class="s">"foo bar"</span><span class="p">,</span> <span class="nv">page</span><span class="p">:</span> <span class="mi">1</span><span class="p">))</span> <span class="c1">// ?q=foo+bar&offset=50
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="kt">Router</span><span class="o">.</span><span class="kt">Search</span><span class="p">(</span><span class="nv">query</span><span class="p">:</span> <span class="s">"foo bar"</span><span class="p">,</span> <span class="nv">page</span><span class="p">:</span> <span class="mi">1</span><span class="p">))</span> <span class="c1">// ?q=foo+bar&offset=50
</span></code></pre>
<a href='#crud_amp_authorization' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='crud_amp_authorization'>CRUD & Authorization</h4>
-<pre><code class="highlight swift"><span class="kd">enum</span> <span class="kt">Router</span><span class="p">:</span> <span class="kt">URLRequestConvertible</span> <span class="p">{</span>
+<pre class="highlight swift"><code><span class="kd">enum</span> <span class="kt">Router</span><span class="p">:</span> <span class="kt">URLRequestConvertible</span> <span class="p">{</span>
<span class="kd">static</span> <span class="k">let</span> <span class="nv">baseURLString</span> <span class="o">=</span> <span class="s">"http://example.com"</span>
<span class="kd">static</span> <span class="k">var</span> <span class="nv">OAuthToken</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span>
<span class="k">case</span> <span class="kt">CreateUser</span><span class="p">([</span><span class="kt">String</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">])</span>
<span class="k">case</span> <span class="kt">ReadUser</span><span class="p">(</span><span class="kt">String</span><span class="p">)</span>
@@ -700,10 +711,10 @@
<span class="k">return</span> <span class="n">mutableURLRequest</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
-<pre><code class="highlight swift"><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="kt">Router</span><span class="o">.</span><span class="kt">ReadUser</span><span class="p">(</span><span class="s">"mattt"</span><span class="p">))</span> <span class="c1">// GET /users/mattt
+<pre class="highlight swift"><code><span class="kt">Alamofire</span><span class="o">.</span><span class="nf">request</span><span class="p">(</span><span class="kt">Router</span><span class="o">.</span><span class="kt">ReadUser</span><span class="p">(</span><span class="s">"mattt"</span><span class="p">))</span> <span class="c1">// GET /users/mattt
</span></code></pre>
<hr>
<a href='#faq' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='faq'>FAQ</h2>
<a href='#when_should_i_use_alamofire' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='when_should_i_use_alamofire'>When should I use Alamofire?</h3>