Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Apr 29, 2024

Maintenance ModeYou are viewing Amplify Gen 1 documentation. Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. New project should use Amplify Gen 2. For existing Gen 1 projects, a migration guide and tooling are available to help you upgrade. Switch to the latest Gen 2 docs →

Delete data

Amplify iOS v1 is deprecated as of June 1st, 2024. No new features or bug fixes will be added. Dependencies may become outdated and potentially introduce compatibility issues.

Please use the latest version (v2) of Amplify Library for Swift to get started. Refer to the upgrade guide for instructions on upgrading your application to the latest version.

Amplify libraries should be used for all new cloud connected applications. If you are currently using the AWS Mobile SDK for iOS, you can access the documentation here.

DELETE data

func deleteTodo() {
let request = RESTRequest(path: "/todo")
Amplify.API.delete(request: request) { result in
switch result {
case .success(let data):
let str = String(decoding: data, as: UTF8.self)
print("Success \(str)")
case .failure(let apiError):
print("Failed", apiError)
}
}
}
func deleteTodo() -> AnyCancellable {
let request = RESTRequest(path: "/todo")
let sink = Amplify.API.delete(request: request)
.resultPublisher
.sink {
if case let .failure(apiError) = $0 {
print("Failed", apiError)
}
}
receiveValue: { data in
let str = String(decoding: data, as: UTF8.self)
print("Success \(str)")
}
return sink
}