Search code examples
iosalamofireswift4

Get Response of XML HTTP url using alamofire and Swift4 IOS


I am developing an application in which I need to get the response code of a HTTP URL, The URL returns an xml which is encrypted. I only need to get that encrypted response code into a variable. I've used Alamofire for http request.

Thanks in advance!


Solution

  • Alamofire.request("URL Goes here",method:.get)
     .response { response in
        if let data = response.data {
          print(data)
          var xml = SWXMLHash.parse(data)
          print(xml["e1"]["e2"].element?.text)
        }
     }