-2

In Swift 2 had a method that could parse xml response, but its not working in Swift 3.

Here is my Swift 2.0 method:

Alamofire.request(.GET, "www.example.com", headers: headers)
        .response { (request, response, data, error) in

            let xml = SWXMLHash.parse(data!)
            let e21Time = xml["tabless"]["tables"][0]["UPDATE_TIME"].element?.text
}

can anyone help me with Swift 3 code please?

Pan Mluvčí
  • 1,242
  • 2
  • 21
  • 42

1 Answers1

0

I did not recognize that Alamofire does not contain (request, response, data, error) parameters anymore but just (response) so... this is the solution.

Swift 3

Alamofire.request("https://example.eu/info.php", method: .get, headers: headers).responseJSON { response in        
     let xml = SWXMLHash.parse(response.data!)
}
Pan Mluvčí
  • 1,242
  • 2
  • 21
  • 42