Sample code for 30+ languages & platforms
Swift

Example: Http.QuickGetSb method

Demonstrates the QuickGetSb method.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let http = CkoHttp()!

    // Send the HTTP GET and return the content in a StringBuilder
    let sb = CkoStringBuilder()!
    success = http.quickGetSb(url: "https://www.chilkatsoft.com/helloWorld.json", sbContent: sb)
    if http.lastMethodSuccess == false {
        if http.lastStatus.intValue == 0 {
            // Communications error.  We did not get a response.
            print("\(http.lastErrorText!)")
        }
        else {
            print("Response status code: \(http.lastStatus.intValue)")
            print("Response body error text:")
            print("\(sb.getAsString()!)")
        }

        return
    }

    // The downloaded content:
    print("\(sb.getAsString()!)")
    print("Success")

}