Library / Taps & buttons

Checkbox / task completion check

Checking off a to-do item: a light tick on check, and nothing (or lighter) on uncheck.

0ms 100ms 200ms 300ms 400ms
Feel
A small satisfying pop when completing; unchecking is quieter to feel like an undo.
APIs
.sensoryFeedback(.impact(weight: .light))
Minimum OS
iOS 17+ / iOS 13+
Raw .md
SwiftUI (iOS 17+)
import SwiftUI

struct TaskRow: View {
    @State private var done = false
    let title: String

    var body: some View {
        Button {
            withAnimation(.snappy) { done.toggle() }
        } label: {
            HStack {
                Image(systemName: done ? "checkmark.circle.fill" : "circle")
                    .foregroundStyle(done ? .green : .secondary)
                Text(title)
                    .strikethrough(done, color: .secondary)
            }
        }
        // Pop on completion only; unchecking stays silent
        .sensoryFeedback(trigger: done) { _, isDone in
            isDone ? .impact(weight: .light, intensity: 0.8) : nil
        }
    }
}
Copied