Skip to content

Instantly share code, notes, and snippets.

@saoudrizwan
Last active June 9, 2024 02:36
Show Gist options
  • Save saoudrizwan/82505bad682289baf077ad02ccb15177 to your computer and use it in GitHub Desktop.
Save saoudrizwan/82505bad682289baf077ad02ccb15177 to your computer and use it in GitHub Desktop.
Example of using Taptic Engine haptic signals on iOS
import AudioToolbox.AudioServices
// 'Peek' feedback (weak boom)
let peek = SystemSoundID(1519)
AudioServicesPlaySystemSound(peek)
// 'Pop' feedback (strong boom)
let pop = SystemSoundID(1520)
AudioServicesPlaySystemSound(pop)
// 'Cancelled' feedback (three sequential weak booms)
let cancelled = SystemSoundID(1521)
AudioServicesPlaySystemSound(cancelled)
// 'Try Again' feedback (week boom then strong boom)
let tryAgain = SystemSoundID(1102)
AudioServicesPlaySystemSound(tryAgain)
// 'Failed' feedback (three sequential strong booms)
let failed = SystemSoundID(1107)
AudioServicesPlaySystemSound(failed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment