jazzy 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +7 -5
  3. data/Rakefile +2 -0
  4. data/bin/jazzy +1 -1
  5. data/jazzy.gemspec +1 -0
  6. data/lib/jazzy.rb +1 -0
  7. data/lib/jazzy/assets/css/highlight.css.scss +63 -0
  8. data/lib/jazzy/assets/css/jazzy.css.scss +27 -1
  9. data/lib/jazzy/assets/js/jazzy.js +8 -2
  10. data/lib/jazzy/config.rb +32 -0
  11. data/lib/jazzy/doc.mustache +15 -1
  12. data/lib/jazzy/doc_builder.rb +24 -12
  13. data/lib/jazzy/docset_builder.rb +77 -0
  14. data/lib/jazzy/docset_builder/info_plist.mustache +20 -0
  15. data/lib/jazzy/gem_version.rb +1 -1
  16. data/lib/jazzy/highlighter.rb +10 -0
  17. data/lib/jazzy/partials/task.mustache +3 -3
  18. data/lib/jazzy/source_declaration.rb +3 -3
  19. data/lib/jazzy/source_declaration/type.rb +136 -0
  20. data/lib/jazzy/source_module.rb +10 -0
  21. data/lib/jazzy/sourcekitten.rb +35 -62
  22. data/logo.sketch +0 -0
  23. data/spec/integration_spec.rb +10 -0
  24. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Info.plist +20 -0
  25. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Classes.html +267 -0
  26. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Classes/Manager.html +488 -0
  27. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Classes/Manager/init(configuration:).html +218 -0
  28. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Classes/Request.html +841 -0
  29. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Enums.html +257 -0
  30. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Enums/ParameterEncoding.html +346 -0
  31. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Extensions.html +708 -0
  32. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Extensions/Manager.html +344 -0
  33. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Extensions/Request.html +368 -0
  34. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Functions.html +1040 -0
  35. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Global Variables.html +226 -0
  36. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Manager.html +344 -0
  37. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Manager/init(configuration:).html +218 -0
  38. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/ParameterEncoding.html +346 -0
  39. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Protocols.html +275 -0
  40. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Protocols/URLRequestConvertible.html +227 -0
  41. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Protocols/URLStringConvertible.html +227 -0
  42. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Request.html +368 -0
  43. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/URLRequestConvertible.html +227 -0
  44. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/URLStringConvertible.html +227 -0
  45. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/carat.png +0 -0
  46. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/css/highlight.css +202 -0
  47. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/css/jazzy.css +708 -0
  48. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/dash.png +0 -0
  49. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/gh.png +0 -0
  50. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/highlight.css +202 -0
  51. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/img/carat.png +0 -0
  52. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/img/dash.png +0 -0
  53. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/img/gh.png +0 -0
  54. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/index.html +755 -0
  55. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/init(configuration:).html +218 -0
  56. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/jazzy.css +708 -0
  57. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/jazzy.js +21 -0
  58. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/jquery.min.js +4 -0
  59. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/js/jazzy.js +21 -0
  60. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/js/jquery.min.js +4 -0
  61. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/docSet.dsidx.csv +81 -0
  62. data/spec/integration_specs/document_alamofire/after/docs/Classes.html +18 -7
  63. data/spec/integration_specs/document_alamofire/after/docs/Classes/Manager.html +31 -19
  64. data/spec/integration_specs/document_alamofire/after/docs/Classes/Manager/init(configuration:).html +14 -1
  65. data/spec/integration_specs/document_alamofire/after/docs/Classes/Request.html +61 -46
  66. data/spec/integration_specs/document_alamofire/after/docs/Enums.html +18 -7
  67. data/spec/integration_specs/document_alamofire/after/docs/Enums/ParameterEncoding.html +20 -4
  68. data/spec/integration_specs/document_alamofire/after/docs/Extensions.html +68 -48
  69. data/spec/integration_specs/document_alamofire/after/docs/Extensions/Manager.html +21 -7
  70. data/spec/integration_specs/document_alamofire/after/docs/Extensions/Request.html +22 -10
  71. data/spec/integration_specs/document_alamofire/after/docs/Functions.html +51 -34
  72. data/spec/integration_specs/document_alamofire/after/docs/Global Variables.html +15 -4
  73. data/spec/integration_specs/document_alamofire/after/docs/Protocols.html +20 -7
  74. data/spec/integration_specs/document_alamofire/after/docs/Protocols/URLRequestConvertible.html +16 -4
  75. data/spec/integration_specs/document_alamofire/after/docs/Protocols/URLStringConvertible.html +16 -4
  76. data/spec/integration_specs/document_alamofire/after/docs/css/highlight.css +202 -0
  77. data/spec/integration_specs/document_alamofire/after/docs/css/jazzy.css +14 -0
  78. data/spec/integration_specs/document_alamofire/after/docs/index.html +53 -42
  79. data/spec/integration_specs/document_alamofire/after/docs/js/jazzy.js +8 -2
  80. data/spec/integration_specs/misc_jazzy_features/after/docs/Classes.html +34 -22
  81. data/spec/integration_specs/misc_jazzy_features/after/docs/Classes/ImplicitlyInternalTopLevelClass.html +16 -4
  82. data/spec/integration_specs/misc_jazzy_features/after/docs/Enums.html +16 -4
  83. data/spec/integration_specs/misc_jazzy_features/after/docs/Enums/DocumentedEnum.html +14 -1
  84. data/spec/integration_specs/misc_jazzy_features/after/docs/Global Variables.html +16 -4
  85. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Info.plist +20 -0
  86. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes.html +309 -0
  87. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes/ImplicitlyInternalTopLevelClass.html +143 -0
  88. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/DocumentedEnum.html +134 -0
  89. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/Enums.html +147 -0
  90. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/Enums/DocumentedEnum.html +134 -0
  91. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/Global Variables.html +146 -0
  92. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/ImplicitlyInternalTopLevelClass.html +143 -0
  93. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/carat.png +0 -0
  94. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/css/highlight.css +202 -0
  95. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/css/jazzy.css +708 -0
  96. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/dash.png +0 -0
  97. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/gh.png +0 -0
  98. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/highlight.css +202 -0
  99. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/img/carat.png +0 -0
  100. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/img/dash.png +0 -0
  101. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/img/gh.png +0 -0
  102. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/index.html +106 -0
  103. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/jazzy.css +708 -0
  104. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/jazzy.js +21 -0
  105. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/jquery.min.js +4 -0
  106. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/js/jazzy.js +21 -0
  107. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/js/jquery.min.js +4 -0
  108. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/docSet.dsidx.csv +15 -0
  109. data/spec/integration_specs/misc_jazzy_features/after/docs/css/highlight.css +202 -0
  110. data/spec/integration_specs/misc_jazzy_features/after/docs/css/jazzy.css +14 -0
  111. data/spec/integration_specs/misc_jazzy_features/after/docs/index.html +12 -1
  112. data/spec/integration_specs/misc_jazzy_features/after/docs/js/jazzy.js +8 -2
  113. metadata +88 -5
  114. data/lib/jazzy/assets/css/github_syntax_highlighting.css.scss +0 -142
  115. data/spec/integration_specs/document_alamofire/after/docs/css/github_syntax_highlighting.css +0 -98
  116. data/spec/integration_specs/misc_jazzy_features/after/docs/css/github_syntax_highlighting.css +0 -98
@@ -3,8 +3,19 @@
3
3
  <head>
4
4
  <title>Protocols Reference</title>
5
5
  <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
6
- <link rel="stylesheet" type="text/css" href="css/github_syntax_highlighting.css" />
6
+ <link rel="stylesheet" type="text/css" href="css/highlight.css" />
7
7
  <meta charset='utf-8'>
8
+ <script type="text/javascript">
9
+ window.jazzy = {'docset': false}
10
+ if (typeof window.dash != 'undefined') {
11
+ document.documentElement.className += ' dash'
12
+ window.jazzy.docset = true
13
+ }
14
+ if (navigator.userAgent.match(/xcode/i)) {
15
+ document.documentElement.className += ' xcode'
16
+ window.jazzy.docset = true
17
+ }
18
+ </script>
8
19
  <script src="js/jquery.min.js" defer></script>
9
20
  <script src="js/jazzy.js" defer></script>
10
21
  </head>
@@ -167,6 +178,7 @@
167
178
  <div class="task-name-container">
168
179
  <hr/>
169
180
  <a name="/URLStringConvertible"></a>
181
+ <a name="//apple_ref/swift/Section/URLStringConvertible" class="dashAnchor"></a>
170
182
  <a href="#/URLStringConvertible">
171
183
  <h3 class="section-name">URLStringConvertible</h3>
172
184
  </a>
@@ -177,6 +189,7 @@
177
189
  <div class="task-group-term">
178
190
  <code>
179
191
  <a name="/s:P9Alamofire20URLStringConvertible">
192
+ <a name="//apple_ref/swift/Protocol/URLStringConvertible" class="dashAnchor"></a>
180
193
  <a class="x-instance-method Swift" href="#/s:P9Alamofire20URLStringConvertible">URLStringConvertible</a>
181
194
  </code>
182
195
  </div>
@@ -193,9 +206,8 @@
193
206
 
194
207
  <div class="Swift">
195
208
  <p class="aside-title">Swift</p>
196
- <p class="para">
197
- <code>public protocol URLStringConvertible</code>
198
- </p>
209
+ <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">URLStringConvertible</span></code></pre>
210
+
199
211
  </div>
200
212
  </div>
201
213
  <div class="result-description view-on-github">
@@ -210,6 +222,7 @@
210
222
  <div class="task-name-container">
211
223
  <hr/>
212
224
  <a name="/URLRequestConvertible"></a>
225
+ <a name="//apple_ref/swift/Section/URLRequestConvertible" class="dashAnchor"></a>
213
226
  <a href="#/URLRequestConvertible">
214
227
  <h3 class="section-name">URLRequestConvertible</h3>
215
228
  </a>
@@ -220,6 +233,7 @@
220
233
  <div class="task-group-term">
221
234
  <code>
222
235
  <a name="/s:P9Alamofire21URLRequestConvertible">
236
+ <a name="//apple_ref/swift/Protocol/URLRequestConvertible" class="dashAnchor"></a>
223
237
  <a class="x-instance-method Swift" href="#/s:P9Alamofire21URLRequestConvertible">URLRequestConvertible</a>
224
238
  </code>
225
239
  </div>
@@ -236,9 +250,8 @@
236
250
 
237
251
  <div class="Swift">
238
252
  <p class="aside-title">Swift</p>
239
- <p class="para">
240
- <code>public protocol URLRequestConvertible</code>
241
- </p>
253
+ <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">URLRequestConvertible</span></code></pre>
254
+
242
255
  </div>
243
256
  </div>
244
257
  <div class="result-description view-on-github">
@@ -3,12 +3,24 @@
3
3
  <head>
4
4
  <title>URLRequestConvertible Protocol Reference</title>
5
5
  <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
6
- <link rel="stylesheet" type="text/css" href="../css/github_syntax_highlighting.css" />
6
+ <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
7
7
  <meta charset='utf-8'>
8
+ <script type="text/javascript">
9
+ window.jazzy = {'docset': false}
10
+ if (typeof window.dash != 'undefined') {
11
+ document.documentElement.className += ' dash'
12
+ window.jazzy.docset = true
13
+ }
14
+ if (navigator.userAgent.match(/xcode/i)) {
15
+ document.documentElement.className += ' xcode'
16
+ window.jazzy.docset = true
17
+ }
18
+ </script>
8
19
  <script src="../js/jquery.min.js" defer></script>
9
20
  <script src="../js/jazzy.js" defer></script>
10
21
  </head>
11
22
  <body id="reference" class="Swift">
23
+ <a name="//apple_ref/swift/Protocol/URLRequestConvertible" class="dashAnchor"></a>
12
24
  <a title="URLRequestConvertible Protocol Reference"></a>
13
25
  <header>
14
26
  <div class="content-wrapper">
@@ -174,6 +186,7 @@
174
186
  <div class="task-group-term">
175
187
  <code>
176
188
  <a name="/s:vP9Alamofire21URLRequestConvertible10URLRequestCSo12NSURLRequest">
189
+ <a name="//apple_ref/swift/Property/URLRequest" class="dashAnchor"></a>
177
190
  <a class="x-instance-method Swift" href="#/s:vP9Alamofire21URLRequestConvertible10URLRequestCSo12NSURLRequest">URLRequest</a>
178
191
  </code>
179
192
  </div>
@@ -189,9 +202,8 @@
189
202
 
190
203
  <div class="Swift">
191
204
  <p class="aside-title">Swift</p>
192
- <p class="para">
193
- <code>var URLRequest: NSURLRequest { get }</code>
194
- </p>
205
+ <pre class="highlight"><code><span class="k">var</span> <span class="nv">URLRequest</span><span class="p">:</span> <span class="kt">NSURLRequest</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
206
+
195
207
  </div>
196
208
  </div>
197
209
  <div class="result-description view-on-github">
@@ -3,12 +3,24 @@
3
3
  <head>
4
4
  <title>URLStringConvertible Protocol Reference</title>
5
5
  <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
6
- <link rel="stylesheet" type="text/css" href="../css/github_syntax_highlighting.css" />
6
+ <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
7
7
  <meta charset='utf-8'>
8
+ <script type="text/javascript">
9
+ window.jazzy = {'docset': false}
10
+ if (typeof window.dash != 'undefined') {
11
+ document.documentElement.className += ' dash'
12
+ window.jazzy.docset = true
13
+ }
14
+ if (navigator.userAgent.match(/xcode/i)) {
15
+ document.documentElement.className += ' xcode'
16
+ window.jazzy.docset = true
17
+ }
18
+ </script>
8
19
  <script src="../js/jquery.min.js" defer></script>
9
20
  <script src="../js/jazzy.js" defer></script>
10
21
  </head>
11
22
  <body id="reference" class="Swift">
23
+ <a name="//apple_ref/swift/Protocol/URLStringConvertible" class="dashAnchor"></a>
12
24
  <a title="URLStringConvertible Protocol Reference"></a>
13
25
  <header>
14
26
  <div class="content-wrapper">
@@ -174,6 +186,7 @@
174
186
  <div class="task-group-term">
175
187
  <code>
176
188
  <a name="/s:vP9Alamofire20URLStringConvertible9URLStringSS">
189
+ <a name="//apple_ref/swift/Property/URLString" class="dashAnchor"></a>
177
190
  <a class="x-instance-method Swift" href="#/s:vP9Alamofire20URLStringConvertible9URLStringSS">URLString</a>
178
191
  </code>
179
192
  </div>
@@ -189,9 +202,8 @@
189
202
 
190
203
  <div class="Swift">
191
204
  <p class="aside-title">Swift</p>
192
- <p class="para">
193
- <code>var URLString: String { get }</code>
194
- </p>
205
+ <pre class="highlight"><code><span class="k">var</span> <span class="nv">URLString</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
206
+
195
207
  </div>
196
208
  </div>
197
209
  <div class="result-description view-on-github">
@@ -0,0 +1,202 @@
1
+ /* Credit to https://gist.github.com/wataru420/2048287 */
2
+ .highlight {
3
+ /* Comment */
4
+ /* Error */
5
+ /* Keyword */
6
+ /* Operator */
7
+ /* Comment.Multiline */
8
+ /* Comment.Preproc */
9
+ /* Comment.Single */
10
+ /* Comment.Special */
11
+ /* Generic.Deleted */
12
+ /* Generic.Deleted.Specific */
13
+ /* Generic.Emph */
14
+ /* Generic.Error */
15
+ /* Generic.Heading */
16
+ /* Generic.Inserted */
17
+ /* Generic.Inserted.Specific */
18
+ /* Generic.Output */
19
+ /* Generic.Prompt */
20
+ /* Generic.Strong */
21
+ /* Generic.Subheading */
22
+ /* Generic.Traceback */
23
+ /* Keyword.Constant */
24
+ /* Keyword.Declaration */
25
+ /* Keyword.Pseudo */
26
+ /* Keyword.Reserved */
27
+ /* Keyword.Type */
28
+ /* Literal.Number */
29
+ /* Literal.String */
30
+ /* Name.Attribute */
31
+ /* Name.Builtin */
32
+ /* Name.Class */
33
+ /* Name.Constant */
34
+ /* Name.Entity */
35
+ /* Name.Exception */
36
+ /* Name.Function */
37
+ /* Name.Namespace */
38
+ /* Name.Tag */
39
+ /* Name.Variable */
40
+ /* Operator.Word */
41
+ /* Text.Whitespace */
42
+ /* Literal.Number.Float */
43
+ /* Literal.Number.Hex */
44
+ /* Literal.Number.Integer */
45
+ /* Literal.Number.Oct */
46
+ /* Literal.String.Backtick */
47
+ /* Literal.String.Char */
48
+ /* Literal.String.Doc */
49
+ /* Literal.String.Double */
50
+ /* Literal.String.Escape */
51
+ /* Literal.String.Heredoc */
52
+ /* Literal.String.Interpol */
53
+ /* Literal.String.Other */
54
+ /* Literal.String.Regex */
55
+ /* Literal.String.Single */
56
+ /* Literal.String.Symbol */
57
+ /* Name.Builtin.Pseudo */
58
+ /* Name.Variable.Class */
59
+ /* Name.Variable.Global */
60
+ /* Name.Variable.Instance */
61
+ /* Literal.Number.Integer.Long */ }
62
+ .highlight .c {
63
+ color: #999988;
64
+ font-style: italic; }
65
+ .highlight .err {
66
+ color: #a61717;
67
+ background-color: #e3d2d2; }
68
+ .highlight .k {
69
+ color: #000000;
70
+ font-weight: bold; }
71
+ .highlight .o {
72
+ color: #000000;
73
+ font-weight: bold; }
74
+ .highlight .cm {
75
+ color: #999988;
76
+ font-style: italic; }
77
+ .highlight .cp {
78
+ color: #999999;
79
+ font-weight: bold; }
80
+ .highlight .c1 {
81
+ color: #999988;
82
+ font-style: italic; }
83
+ .highlight .cs {
84
+ color: #999999;
85
+ font-weight: bold;
86
+ font-style: italic; }
87
+ .highlight .gd {
88
+ color: #000000;
89
+ background-color: #ffdddd; }
90
+ .highlight .gd .x {
91
+ color: #000000;
92
+ background-color: #ffaaaa; }
93
+ .highlight .ge {
94
+ color: #000000;
95
+ font-style: italic; }
96
+ .highlight .gr {
97
+ color: #aa0000; }
98
+ .highlight .gh {
99
+ color: #999999; }
100
+ .highlight .gi {
101
+ color: #000000;
102
+ background-color: #ddffdd; }
103
+ .highlight .gi .x {
104
+ color: #000000;
105
+ background-color: #aaffaa; }
106
+ .highlight .go {
107
+ color: #888888; }
108
+ .highlight .gp {
109
+ color: #555555; }
110
+ .highlight .gs {
111
+ font-weight: bold; }
112
+ .highlight .gu {
113
+ color: #aaaaaa; }
114
+ .highlight .gt {
115
+ color: #aa0000; }
116
+ .highlight .kc {
117
+ color: #000000;
118
+ font-weight: bold; }
119
+ .highlight .kd {
120
+ color: #000000;
121
+ font-weight: bold; }
122
+ .highlight .kp {
123
+ color: #000000;
124
+ font-weight: bold; }
125
+ .highlight .kr {
126
+ color: #000000;
127
+ font-weight: bold; }
128
+ .highlight .kt {
129
+ color: #445588;
130
+ font-weight: bold; }
131
+ .highlight .m {
132
+ color: #009999; }
133
+ .highlight .s {
134
+ color: #d14; }
135
+ .highlight .na {
136
+ color: #008080; }
137
+ .highlight .nb {
138
+ color: #0086B3; }
139
+ .highlight .nc {
140
+ color: #445588;
141
+ font-weight: bold; }
142
+ .highlight .no {
143
+ color: #008080; }
144
+ .highlight .ni {
145
+ color: #800080; }
146
+ .highlight .ne {
147
+ color: #990000;
148
+ font-weight: bold; }
149
+ .highlight .nf {
150
+ color: #990000;
151
+ font-weight: bold; }
152
+ .highlight .nn {
153
+ color: #555555; }
154
+ .highlight .nt {
155
+ color: #000080; }
156
+ .highlight .nv {
157
+ color: #008080; }
158
+ .highlight .ow {
159
+ color: #000000;
160
+ font-weight: bold; }
161
+ .highlight .w {
162
+ color: #bbbbbb; }
163
+ .highlight .mf {
164
+ color: #009999; }
165
+ .highlight .mh {
166
+ color: #009999; }
167
+ .highlight .mi {
168
+ color: #009999; }
169
+ .highlight .mo {
170
+ color: #009999; }
171
+ .highlight .sb {
172
+ color: #d14; }
173
+ .highlight .sc {
174
+ color: #d14; }
175
+ .highlight .sd {
176
+ color: #d14; }
177
+ .highlight .s2 {
178
+ color: #d14; }
179
+ .highlight .se {
180
+ color: #d14; }
181
+ .highlight .sh {
182
+ color: #d14; }
183
+ .highlight .si {
184
+ color: #d14; }
185
+ .highlight .sx {
186
+ color: #d14; }
187
+ .highlight .sr {
188
+ color: #009926; }
189
+ .highlight .s1 {
190
+ color: #d14; }
191
+ .highlight .ss {
192
+ color: #990073; }
193
+ .highlight .bp {
194
+ color: #999999; }
195
+ .highlight .vc {
196
+ color: #008080; }
197
+ .highlight .vg {
198
+ color: #008080; }
199
+ .highlight .vi {
200
+ color: #008080; }
201
+ .highlight .il {
202
+ color: #009999; }
@@ -7,6 +7,9 @@ html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr
7
7
  padding: 0;
8
8
  vertical-align: baseline; }
9
9
 
10
+ #reference .declaration .Swift pre {
11
+ white-space: pre-wrap;
12
+ font-size: 140%; }
10
13
  #reference .x-instance-method.Swift {
11
14
  margin-left: 15px; }
12
15
  #reference .chapter {
@@ -692,3 +695,14 @@ td {
692
695
  border: 0; }
693
696
  .readme pre code:before, .readme pre code:after {
694
697
  content: normal; }
698
+
699
+ html.dash .book-parts {
700
+ display: none;
701
+ width: 0; }
702
+ html.dash .chapter {
703
+ width: 980px;
704
+ margin-left: 0; }
705
+ html.dash #reference .height-container {
706
+ display: block; }
707
+ html.dash #reference .x-instance-method {
708
+ margin-left: 0; }
@@ -3,8 +3,19 @@
3
3
  <head>
4
4
  <title>Alamofire Reference</title>
5
5
  <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
6
- <link rel="stylesheet" type="text/css" href="css/github_syntax_highlighting.css" />
6
+ <link rel="stylesheet" type="text/css" href="css/highlight.css" />
7
7
  <meta charset='utf-8'>
8
+ <script type="text/javascript">
9
+ window.jazzy = {'docset': false}
10
+ if (typeof window.dash != 'undefined') {
11
+ document.documentElement.className += ' dash'
12
+ window.jazzy.docset = true
13
+ }
14
+ if (navigator.userAgent.match(/xcode/i)) {
15
+ document.documentElement.className += ' xcode'
16
+ window.jazzy.docset = true
17
+ }
18
+ </script>
8
19
  <script src="js/jquery.min.js" defer></script>
9
20
  <script src="js/jazzy.js" defer></script>
10
21
  </head>
@@ -207,12 +218,12 @@
207
218
  <hr>
208
219
  <a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='usage'>Usage</h2>
209
220
  <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>
210
- <pre><code class="highlight swift"><span class="kd">import</span> <span class="kt">Alamofire</span>
221
+ <pre class="highlight swift"><code><span class="kd">import</span> <span class="kt">Alamofire</span>
211
222
 
212
223
  <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>
213
224
  </code></pre>
214
225
  <a href='#response_handling' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='response_handling'>Response Handling</h3>
215
- <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>
226
+ <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>
216
227
  <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>
217
228
  <span class="nf">println</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
218
229
  <span class="nf">println</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
@@ -231,19 +242,19 @@
231
242
  <li><code>responsePropertyList(options: NSPropertyListReadOptions)</code></li>
232
243
  </ul>
233
244
  <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>
234
- <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>
245
+ <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>
235
246
  <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>
236
247
  <span class="nf">println</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
237
248
  <span class="p">}</span>
238
249
  </code></pre>
239
250
  <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>
240
- <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>
251
+ <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>
241
252
  <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>
242
253
  <span class="nf">println</span><span class="p">(</span><span class="kt">JSON</span><span class="p">)</span>
243
254
  <span class="p">}</span>
244
255
  </code></pre>
245
256
  <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>
246
- <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>
257
+ <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>
247
258
  <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>
248
259
  <span class="nf">println</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
249
260
  <span class="p">}</span>
@@ -252,7 +263,7 @@
252
263
  <span class="p">}</span>
253
264
  </code></pre>
254
265
  <a href='#http_methods' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='http_methods'>HTTP Methods</h3>
255
- <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>
266
+ <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>
256
267
  <span class="k">case</span> <span class="kt">OPTIONS</span> <span class="o">=</span> <span class="s">"OPTIONS"</span>
257
268
  <span class="k">case</span> <span class="kt">GET</span> <span class="o">=</span> <span class="s">"GET"</span>
258
269
  <span class="k">case</span> <span class="kt">HEAD</span> <span class="o">=</span> <span class="s">"HEAD"</span>
@@ -264,7 +275,7 @@
264
275
  <span class="k">case</span> <span class="kt">CONNECT</span> <span class="o">=</span> <span class="s">"CONNECT"</span>
265
276
  <span class="p">}</span>
266
277
  </code></pre>
267
- <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>
278
+ <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>
268
279
 
269
280
  <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>
270
281
 
@@ -272,11 +283,11 @@
272
283
  </code></pre>
273
284
  <a href='#parameters' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='parameters'>Parameters</h3>
274
285
  <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>
275
- <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>
286
+ <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>
276
287
  <span class="c1">// http://httpbin.org/get?foo=bar
277
288
  </span></code></pre>
278
289
  <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>
279
- <pre><code class="highlight swift"><span class="k">let</span> <span class="nv">parameters</span> <span class="o">=</span> <span class="p">[</span>
290
+ <pre class="highlight swift"><code><span class="k">let</span> <span class="nv">parameters</span> <span class="o">=</span> <span class="p">[</span>
280
291
  <span class="s">"foo"</span><span class="p">:</span> <span class="s">"bar"</span><span class="p">,</span>
281
292
  <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>
282
293
  <span class="s">"qux"</span><span class="p">:</span> <span class="p">[</span>
@@ -290,7 +301,7 @@
290
301
  <span class="c1">// HTTP body: foo=bar&amp;baz[]=a&amp;baz[]=1&amp;qux[x]=1&amp;qux[y]=2&amp;qux[z]=3
291
302
  </span></code></pre>
292
303
  <a href='#parameter_encoding' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='parameter_encoding'>Parameter Encoding</h3>
293
- <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>
304
+ <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>
294
305
  <span class="k">case</span> <span class="kt">URL</span>
295
306
  <span class="k">case</span> <span class="kt">JSON</span>
296
307
  <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>
@@ -310,7 +321,7 @@
310
321
  <li><code>Custom</code>: Uses the associated closure value to construct a new request given an existing request and parameters.</li>
311
322
  </ul>
312
323
  <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>
313
- <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>
324
+ <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>
314
325
  <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>
315
326
 
316
327
  <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>
@@ -318,7 +329,7 @@
318
329
  <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>
319
330
  </code></pre>
320
331
  <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>
321
- <pre><code class="highlight swift"><span class="k">let</span> <span class="nv">parameters</span> <span class="o">=</span> <span class="p">[</span>
332
+ <pre class="highlight swift"><code><span class="k">let</span> <span class="nv">parameters</span> <span class="o">=</span> <span class="p">[</span>
322
333
  <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>
323
334
  <span class="s">"bar"</span><span class="p">:</span> <span class="p">[</span>
324
335
  <span class="s">"baz"</span><span class="p">:</span> <span class="s">"qux"</span>
@@ -337,14 +348,14 @@
337
348
  <li>Stream</li>
338
349
  </ul>
339
350
  <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>
340
- <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>
351
+ <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>
341
352
  <span class="o">.</span><span class="kt">URLForResource</span><span class="p">(</span><span class="s">"Default"</span><span class="p">,</span>
342
353
  <span class="nv">withExtension</span><span class="p">:</span> <span class="s">"png"</span><span class="p">)</span>
343
354
 
344
355
  <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>
345
356
  </code></pre>
346
357
  <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>
347
- <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>
358
+ <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>
348
359
  <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>
349
360
  <span class="nf">println</span><span class="p">(</span><span class="n">totalBytesWritten</span><span class="p">)</span>
350
361
  <span class="p">}</span>
@@ -359,7 +370,7 @@
359
370
  <li>Resume Data</li>
360
371
  </ul>
361
372
  <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>
362
- <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>
373
+ <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>
363
374
  <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>
364
375
  <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>
365
376
  <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>
@@ -373,12 +384,12 @@
373
384
  <span class="p">})</span>
374
385
  </code></pre>
375
386
  <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>
376
- <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>
387
+ <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>
377
388
 
378
389
  <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>
379
390
  </code></pre>
380
391
  <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>
381
- <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>
392
+ <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>
382
393
  <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>
383
394
  <span class="nf">println</span><span class="p">(</span><span class="n">totalBytesRead</span><span class="p">)</span>
384
395
  <span class="p">}</span>
@@ -395,7 +406,7 @@
395
406
  <li><a href="http://en.wikipedia.org/wiki/NT_LAN_Manager">NTLM</a></li>
396
407
  </ul>
397
408
  <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>
398
- <pre><code class="highlight swift"><span class="k">let</span> <span class="nv">user</span> <span class="o">=</span> <span class="s">"user"</span>
409
+ <pre class="highlight swift"><code><span class="k">let</span> <span class="nv">user</span> <span class="o">=</span> <span class="s">"user"</span>
399
410
  <span class="k">let</span> <span class="nv">password</span> <span class="o">=</span> <span class="s">"password"</span>
400
411
 
401
412
  <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>
@@ -405,7 +416,7 @@
405
416
  <span class="p">}</span>
406
417
  </code></pre>
407
418
  <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>
408
- <pre><code class="highlight swift"><span class="k">let</span> <span class="nv">user</span> <span class="o">=</span> <span class="s">"user"</span>
419
+ <pre class="highlight swift"><code><span class="k">let</span> <span class="nv">user</span> <span class="o">=</span> <span class="s">"user"</span>
409
420
  <span class="k">let</span> <span class="nv">password</span> <span class="o">=</span> <span class="s">"password"</span>
410
421
 
411
422
  <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>
@@ -418,7 +429,7 @@
418
429
  </code></pre>
419
430
  <a href='#validation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='validation'>Validation</h3>
420
431
  <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>
421
- <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>
432
+ <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>
422
433
  <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">..&lt;</span><span class="mi">300</span><span class="p">)</span>
423
434
  <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>
424
435
  <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>
@@ -426,25 +437,25 @@
426
437
  <span class="p">}</span>
427
438
  </code></pre>
428
439
  <a href='#automatic_validation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='automatic_validation'>Automatic Validation</h4>
429
- <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>
440
+ <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>
430
441
  <span class="o">.</span><span class="nf">validate</span><span class="p">()</span>
431
442
  <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>
432
443
  <span class="nf">println</span><span class="p">(</span><span class="n">error</span><span class="p">)</span>
433
444
  <span class="p">}</span>
434
445
  </code></pre>
435
446
  <a href='#printable' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='printable'>Printable</h3>
436
- <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>
447
+ <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>
437
448
 
438
449
  <span class="nf">println</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
439
450
  <span class="c1">// GET http://httpbin.org/ip (200)
440
451
  </span></code></pre>
441
452
  <a href='#debugprintable' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='debugprintable'>DebugPrintable</h3>
442
- <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>
453
+ <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>
443
454
 
444
455
  <span class="nf">debugPrintln</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
445
456
  </code></pre>
446
457
  <a href='#output_curl' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='output_curl'>Output (cURL)</h4>
447
- <pre><code class="highlight plaintext">$ curl -i \
458
+ <pre class="highlight plaintext"><code>$ curl -i \
448
459
  -H "User-Agent: Alamofire" \
449
460
  -H "Accept-Encoding: Accept-Encoding: gzip;q=1.0,compress;q=0.5" \
450
461
  -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" \
@@ -465,25 +476,25 @@ this framework, it is recommended that you be familiar with the concepts and cap
465
476
  <li><a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURLAuthenticationChallenge_Class/Reference/Reference.html">NSURLAuthenticationChallenge Class Reference</a></li>
466
477
  </ul>
467
478
  <a href='#manager' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='manager'>Manager</h3>
468
- <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>
479
+ <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>
469
480
  </code></pre>
470
- <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>
481
+ <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>
471
482
  <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>
472
483
  </code></pre>
473
484
  <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>
474
- <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>
485
+ <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>
475
486
  <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>
476
487
  </code></pre>
477
488
  <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>
478
- <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>
489
+ <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>
479
490
  <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>
480
491
  </code></pre>
481
492
  <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>
482
- <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>
493
+ <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>
483
494
  <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>
484
495
  </code></pre>
485
496
  <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>
486
- <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>
497
+ <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>
487
498
  <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>
488
499
 
489
500
  <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>
@@ -503,7 +514,7 @@ this framework, it is recommended that you be familiar with the concepts and cap
503
514
  </ul>
504
515
  <a href='#response_serialization' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='response_serialization'>Response Serialization</h3>
505
516
  <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>
506
- <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&rsquo;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>
517
+ <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&rsquo;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>
507
518
  <span class="kd">class</span> <span class="kd">func</span> <span class="kt">XMLResponseSerializer</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">Serializer</span> <span class="p">{</span>
508
519
  <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>
509
520
  <span class="k">if</span> <span class="n">data</span> <span class="o">==</span> <span class="kc">nil</span> <span class="p">{</span>
@@ -525,7 +536,7 @@ this framework, it is recommended that you be familiar with the concepts and cap
525
536
  <span class="p">}</span>
526
537
  </code></pre>
527
538
  <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>
528
- <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>
539
+ <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>
529
540
  <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>
530
541
  <span class="p">}</span>
531
542
 
@@ -547,7 +558,7 @@ this framework, it is recommended that you be familiar with the concepts and cap
547
558
  <span class="p">}</span>
548
559
  <span class="p">}</span>
549
560
  </code></pre>
550
- <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>
561
+ <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>
551
562
  <span class="k">let</span> <span class="nv">username</span><span class="p">:</span> <span class="kt">String</span>
552
563
  <span class="k">let</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span>
553
564
 
@@ -557,12 +568,12 @@ this framework, it is recommended that you be familiar with the concepts and cap
557
568
  <span class="p">}</span>
558
569
  <span class="p">}</span>
559
570
  </code></pre>
560
- <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>
571
+ <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>
561
572
  <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>
562
573
  <span class="nf">println</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
563
574
  <span class="p">}</span>
564
575
  </code></pre>
565
- <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>
576
+ <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>
566
577
  <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">-&gt;</span> <span class="p">[</span><span class="k">Self</span><span class="p">]</span>
567
578
  <span class="p">}</span>
568
579
 
@@ -586,7 +597,7 @@ this framework, it is recommended that you be familiar with the concepts and cap
586
597
  </code></pre>
587
598
  <a href='#urlstringconvertible' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='urlstringconvertible'>URLStringConvertible</h3>
588
599
  <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>
589
- <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>
600
+ <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>
590
601
  <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>
591
602
 
592
603
  <span class="k">case</span> <span class="kt">Root</span>
@@ -612,11 +623,11 @@ this framework, it is recommended that you be familiar with the concepts and cap
612
623
  <span class="p">}</span>
613
624
  <span class="p">}</span>
614
625
  </code></pre>
615
- <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>
626
+ <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>
616
627
  </code></pre>
617
628
  <a href='#urlrequestconvertible' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='urlrequestconvertible'>URLRequestConvertible</h3>
618
629
  <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>
619
- <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>
630
+ <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>
620
631
  <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>
621
632
  <span class="kd">static</span> <span class="k">let</span> <span class="nv">perPage</span> <span class="o">=</span> <span class="mi">50</span>
622
633
 
@@ -642,10 +653,10 @@ this framework, it is recommended that you be familiar with the concepts and cap
642
653
  <span class="p">}</span>
643
654
  <span class="p">}</span>
644
655
  </code></pre>
645
- <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&amp;offset=50
656
+ <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&amp;offset=50
646
657
  </span></code></pre>
647
658
  <a href='#crud_amp_authorization' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='crud_amp_authorization'>CRUD &amp; Authorization</h4>
648
- <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>
659
+ <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>
649
660
  <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>
650
661
  <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>
651
662
 
@@ -702,7 +713,7 @@ this framework, it is recommended that you be familiar with the concepts and cap
702
713
  <span class="p">}</span>
703
714
  <span class="p">}</span>
704
715
  </code></pre>
705
- <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
716
+ <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
706
717
  </span></code></pre>
707
718
 
708
719
  <hr>