Library / Taps & buttons

Destructive action (delete)

Confirming a delete: a heavy, unmistakable thud that says "this is significant".

0ms 100ms 200ms 300ms 400ms
Feel
Heavy and rigid — noticeably weightier than any other tap in the app.
APIs
.sensoryFeedback(.impact(weight: .heavy))UIImpactFeedbackGenerator(style: .heavy)
Minimum OS
iOS 17+ / iOS 10+
Raw .md
SwiftUI (iOS 17+)
import SwiftUI

struct DeleteButton: View {
    let onDelete: () -> Void
    @State private var confirming = false
    @State private var deleted = 0

    var body: some View {
        Button(role: .destructive) {
            confirming = true
        } label: {
            Label("Delete item", systemImage: "trash")
        }
        .confirmationDialog("Delete this item?", isPresented: $confirming) {
            Button("Delete", role: .destructive) {
                deleted += 1
                onDelete()
            }
        }
        .sensoryFeedback(.impact(weight: .heavy), trigger: deleted)
    }
}
UIKit
let haptic = UIImpactFeedbackGenerator(style: .heavy)

func confirmDelete() {
    haptic.prepare()
    let alert = UIAlertController(title: "Delete this item?",
                                  message: nil,
                                  preferredStyle: .actionSheet)
    alert.addAction(UIAlertAction(title: "Delete", style: .destructive) { _ in
        haptic.impactOccurred()
        // perform deletion
    })
    alert.addAction(UIAlertAction(title: "Cancel", style: .cancel))
    present(alert, animated: true)
}
Copied