Merge pull request #1 from kazuhiro4949/master

add Alamofire example to README.
This commit is contained in:
kazuhiro4949 2016-05-02 10:53:56 +09:00
commit 3a5cd528ef
1 changed files with 20 additions and 0 deletions

View File

@ -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.