Merge pull request #1 from kazuhiro4949/master
add Alamofire example to README.
This commit is contained in:
commit
3a5cd528ef
20
README.md
20
README.md
|
@ -172,6 +172,26 @@ for element in xml["ResultSet", "Result", "Hit"] {
|
|||
xml["ResultSet", "Result", "Hit"].map { $0["Name"].text }
|
||||
```
|
||||
|
||||
## Work with Alamofire
|
||||
SwiftyXMLParser goes well with [Alamofire](https://github.com/Alamofire/Alamofire). You can parse the response easily.
|
||||
|
||||
```swift
|
||||
import Alamofire
|
||||
import SwiftyXMLParser
|
||||
|
||||
Alamofire.request(.GET, "https://itunes.apple.com/us/rss/topgrossingapplications/limit=10/xml")
|
||||
.responseData { response in
|
||||
if let data = response.data {
|
||||
let xml = XML.parse(data)
|
||||
print(xml["feed", "entry", 0, "title"].text) // outputs the top title of iTunes app raning.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In addition, there is the extension of Alamofire to combine with SwiftyXMLPraser.
|
||||
|
||||
* [Alamofire-SwiftyXMLParser](https://github.com/kazuhiro4949/Alamofire-SwiftyXMLParser)
|
||||
|
||||
# License
|
||||
|
||||
This software is released under the MIT License, see LICENSE.
|
||||
|
|
Loading…
Reference in New Issue