Page updated Jan 16, 2024

Delete data

Amplify iOS v1 is now in Maintenance Mode until May 31st, 2024. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v1.

Please use the latest version (v2) of Amplify Library for Swift to get started.

If you are currently using v1, follow these instructions to upgrade to v2.

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

1func deleteTodo() {
2 let request = RESTRequest(path: "/todo")
3 Amplify.API.delete(request: request) { result in
4 switch result {
5 case .success(let data):
6 let str = String(decoding: data, as: UTF8.self)
7 print("Success \(str)")
8 case .failure(let apiError):
9 print("Failed", apiError)
10 }
11 }
12}
1func deleteTodo() -> AnyCancellable {
2 let request = RESTRequest(path: "/todo")
3 let sink = Amplify.API.delete(request: request)
4 .resultPublisher
5 .sink {
6 if case let .failure(apiError) = $0 {
7 print("Failed", apiError)
8 }
9 }
10 receiveValue: { data in
11 let str = String(decoding: data, as: UTF8.self)
12 print("Success \(str)")
13 }
14 return sink
15}