Checkbox / task completion check
Checking off a to-do item: a light tick on check, and nothing (or lighter) on uncheck.
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
}
}
}