Skip to content

Instantly share code, notes, and snippets.

@saoudrizwan
Last active August 15, 2017 04:58
Show Gist options
  • Select an option

  • Save saoudrizwan/d390611f9a283dacea7fc975eb1754d2 to your computer and use it in GitHub Desktop.

Select an option

Save saoudrizwan/d390611f9a283dacea7fc975eb1754d2 to your computer and use it in GitHub Desktop.
Basic vibration example for iOS
import AudioToolbox.AudioServices
// kSystemSoundID_Vibrate is just a UInt32 with a value of 4095
let vibrate = SystemSoundID(kSystemSoundID_Vibrate)
AudioServicesPlaySystemSound(vibrate)
// ... or if you want a completion block to be called after the vibration finishes
let vibrate = SystemSoundID(kSystemSoundID_Vibrate) // 4095
AudioServicesPlaySystemSoundWithCompletion(vibrate, {
print("did vibrate")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment