Swift
Swift
Transition from Http.QuickRequestParams to Http.HttpParams
Provides instructions for replacing deprecated QuickRequestParams method calls with HttpParams.Chilkat Swift Downloads
func chilkatTest() {
var success: Bool = false
let http = CkoHttp()!
var verb: String? = "GET"
var url: String? = "https://example.com/"
let json = CkoJsonObject()!
json.updateInt(jsonPath: "param1", value: 100)
json.updateString(jsonPath: "param2", value: "test")
// ------------------------------------------------------------------------
// The QuickRequestParams method is deprecated:
var responseObj: CkoHttpResponse? = http.quickRequestParams(verb: verb, url: url, json: json)
if http.lastMethodSuccess == false {
print("\(http.lastErrorText!)")
return
}
// ...
// ...
responseObj = nil
// ------------------------------------------------------------------------
// Do the equivalent using HttpParams.
// Your application creates a new, empty HttpResponse object which is passed
// in the last argument and filled upon success.
let responseOut = CkoHttpResponse()!
success = http.httpParams(verb: verb, url: url, json: json, response: responseOut)
if success == false {
print("\(http.lastErrorText!)")
return
}
}