UIKit feedback generator cheat sheet
All three UIFeedbackGenerator families and every style, with the prepare → fire pattern.
import UIKit
// ---------------------------------------------------------------
// 1. IMPACT — a physical collision or snap
// Styles: .light .medium .heavy (mass of the object)
// .soft .rigid (stiffness of the object)
// ---------------------------------------------------------------
let impact = UIImpactFeedbackGenerator(style: .medium)
impact.prepare() // on touch-down / screen appear
impact.impactOccurred() // full strength
impact.impactOccurred(intensity: 0.6) // scaled, 0.0–1.0 (iOS 13+)
// ---------------------------------------------------------------
// 2. SELECTION — ticks while the user moves through values
// (picker rows, segmented controls, dial detents)
// ---------------------------------------------------------------
let selection = UISelectionFeedbackGenerator()
selection.prepare()
selection.selectionChanged() // call once per value change
// ---------------------------------------------------------------
// 3. NOTIFICATION — the outcome of a task
// ---------------------------------------------------------------
let note = UINotificationFeedbackGenerator()
note.prepare()
note.notificationOccurred(.success) // two quick taps, rising
note.notificationOccurred(.warning) // two taps, falling
note.notificationOccurred(.error) // three sharp buzzes
// iOS 17.5+: attach the generator to a view so the system can
// route feedback correctly on devices with multiple engines.
let attached = UIImpactFeedbackGenerator(style: .light, view: someView)