Haptics

Haptic feedback: UIImpactFeedbackGenerator, UINotificationFeedbackGenerator, CoreHaptics custom patterns. Use when implementing app features related to haptics.

abdullah4ai Updated 11 repo stars

File contents

Haptics

HAPTIC FEEDBACK:

  • UIImpactFeedbackGenerator(style: .medium).impactOccurred() for simple taps
  • UINotificationFeedbackGenerator().notificationOccurred(.success/.warning/.error) for outcomes
  • UISelectionFeedbackGenerator().selectionChanged() for selection changes
  • CoreHaptics for custom patterns: CHHapticEngine + CHHapticEvent
  • Always check CHHapticEngine.capabilitiesForHardware().supportsHaptics
  • Prepare generator before use: generator.prepare() for lower latency

abdullah4ai/apple-developer-toolkit commit 7bcb6a877f

Frequently asked questions

npx get-skill add abdullah4ai/haptics-4