Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created June 24, 2026 10:41
Show Gist options
  • Select an option

  • Save jacobsapps/449a2f7e8be7e82d8d27945705f4ae2f to your computer and use it in GitHub Desktop.

Select an option

Save jacobsapps/449a2f7e8be7e82d8d27945705f4ae2f to your computer and use it in GitHub Desktop.
Haptics from My top 3 design “Kisses” I like to add to every app
func playAHAP(_ name: String) {
guard
let engine = try? CHHapticEngine(),
let url = Bundle.main.url(forResource: name, withExtension: "ahap")
else { return }
try? engine.start()
let player = try? engine.makePlayer(with: CHHapticPattern(contentsOf: url))
try? player.start(atTime: CHHapticTimeImmediate)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment