Sample code for 30+ languages & platforms
Swift Requires Chilkat v11.0.0+

Example: Http.GetLastJsonData method

Demonstrates the GetLastJsonData method.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let http = CkoHttp()!
    let resp = CkoHttpResponse()!

    //  Only allow TLS 1.2 or better.
    http.sslProtocol = "TLS 1.2 or higher"

    success = http.httpNoBody(verb: "GET", url: "https://google.com/", response: resp)
    if success == false {
        print("\(http.lastErrorText!)")
        return
    }

    let json = CkoJsonObject()!
    json.emitCompact = false

    http.getLastJsonData(json: json)
    print("\(json.emit()!)")

    //  Output as of Chilkat v11.1.0
    //  Additional information may be added as requested or needed in future versions of Chilkat.

    //  {
    //    "tls": {
    //      "params": {
    //        "sniHostname": "www.google.com",
    //        "allowConnectionOnlyIfServerChooses": "TLS 1.2 or higher"
    //      },
    //      "negotiatedTlsVersion": "TLS 1.3"
    //    }
    //  }

}