Skip to content

Improve the performance (Swift)

Prioregroup.com edited this page Aug 30, 2017 · 3 revisions
import UIKit
import SOAPEngine64
import UTXMLDictionary // https://github.com/ungacy/UTXMLDictionary

class ViewController: UIViewController, SOAPEngineDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let soap = SOAPEngine()
        soap.responseHeader = true
        soap.actionNamespaceSlash = true
        soap.delegate = self
        
        soap.setValue("Genesis", forKey: "BookName")
        soap.setIntegerValue(1, forKey: "chapter")
        soap.requestURL("http://www.prioregroup.com/services/americanbible.asmx",
                        soapAction: "http://www.prioregroup.com/GetVerses")
        
    }
    
    func soapEngine(_ soapEngine: SOAPEngine!, didBeforeParsingResponseData data: Data!) -> Data! {
        let dict = UTXMLDictionary.dictionary(fromXMLData: data) as! [String : AnyObject]
        debugPrint(dict)
        return nil
    }
    
    func soapEngine(_ soapEngine: SOAPEngine!, didFailWithError error: Error!) {
        debugPrint(error)
    }
}