CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✓ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | Sep 2017 |
| SwiftSwift Version | 4.0 |
| SPMSupports SPM | ✗ |
Maintained by Jonas Zaugg.
| Depends on: | |
| Alamofire | ~> 4.0 |
| Fuzi | ~> 2.0 |
XML/HTML response handlers for Alamofire using Fuzi
AlamoFuzi adds .responseXML() and .responseHTML() response handlers to Alamofire’s DataRequest class. Both document types are serialized using Fuzi, the preferred way to parse XML/HTML in Swift.
The easiest way to add AlamoFuzi to your project is to use CocoaPods.
Simply add AlamoFuzi.Swift to your project. Please note that Fuzi and Alamofire must be integrated to your project.
import Alamofire
import AlamoFuzi
Alamofire.request("http://example.org/").responseHTML { response in
switch response.result {
case .failure(let error):
debugPrint("Error: \(error)")
debugPrint(response)
case .success(let document):
// Parsing the HTML data
if let example = document.firstChild(css: "div > p") {
print(example.stringValue)
}
}
}Please note that you need import Alamofire or import Fuzi if you’re using any of their types or classes explicitly. In the example above, we do not explicitly use any types defined by Fuzi (e.g. HTMLDocument) so we don’t have to import it separately.
AlamoFuzi is released under the MIT license. See LICENSE for details.