I get the xml data and with the help of SWXMLHash, I convert them into a dictionary of arris, but I don’t understand how to get access to the key - value or specific data. ( USD and EUR value)?
Sorry for the stupid question, I'm just learning
import UIKit
import Alamofire
import SWXMLHash
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let date = "02/03/2002"
Alamofire.request("http://www.cbr.ru/scripts/XML_daily.asp?date_req=\(date)", parameters: nil) //Alamofire defaults to GET requests
.response { response in
if let data = response.data {
print(data) // if you want to check XML data in debug window.
//let xml = SWXMLHash.parse(data)
let xml = SWXMLHash.parse(response.data!)
// print(xml) // output the FilmID element.
func enumerate(indexer: XMLIndexer) {
for child in indexer.children {
print(child.element!.name, child.element!.text)
enumerate(indexer: child)
}
}
enumerate(indexer: xml)
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}