Sample code for 30+ languages & platforms
Swift

S3 Delete Bucket

See more Amazon S3 Examples

Demonstrates how to delete a bucket.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    // This example assumes 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 = "ABQXXABC83ABCDEFVQXX"

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

    http.keepResponseBody = true

    success = http.s3_DeleteBucket(bucketName: "chilkattestbucket")

    if success != true {
        print("\(http.lastErrorText!)")
        // Also examine the error response body from AWS:
        print("\(http.lastResponseBody!)")
    }
    else {
        print("Bucket deleted.")
    }


}