Sample code for 30+ languages & platforms
Swift

Wasabi Delete Bucket Objects

See more Wasabi Examples

Demonstrates how to delete one or more objects in a bucket.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let http = CkoHttp()!

    // Insert your access key here:
    http.awsAccessKey = "access-key"

    // Insert your secret key here:
    http.awsSecretKey = "secret-key"

    // Use the endpoint matching the bucket's region.
    http.awsEndpoint = "s3.us-west-1.wasabisys.com"

    var bucketName: String? = "chilkattest"

    var objectName1: String? = "seahorse.jpg"
    var objectName2: String? = "seahorse2.jpg"

    let st = CkoStringTable()!
    st.append(value: objectName1)
    st.append(value: objectName2)

    let resp = CkoHttpResponse()!
    success = http.s3_DeleteObjects(bucketName: bucketName, objectNames: st, jsonResponse: resp)
    if success == false {
        print("\(http.lastErrorText!)")
        return
    }

    print("Response status code = \(http.lastStatus.intValue)")

    // Display the XML response.
    print("\(resp.bodyStr!)")

}