<BlockSwitcher>

<Block name="Async/Await">

```swift
func deleteUser() async {
    do {
        try await Amplify.Auth.deleteUser()
        print("Successfully deleted user")
    } catch let error as AuthError {
        print("Delete user failed with error \(error)")
    } catch {
        print("Unexpected error: \(error)")
    }
}
```

</Block>

<Block name="Combine">

```swift
func deleteUser() -> AnyCancellable {
    Amplify.Publisher.create {
        try await Amplify.Auth.deleteUser()
    }.sink {
            if case let .failure(authError) = $0 {
                print("Delete user failed with error \(authError)")
            }
        }
        receiveValue: {
            print("Successfully deleted user")
        }
}
```

</Block>

</BlockSwitcher>
