I'm writing a sprite kit-based app in swift and need to make a short haptic feedback using vibration
so first I imported AudioToolbox and used this
AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))
and it worked well but it vibrates for too long and there's no way to control this duration.
Then after some searching I read Kevin Cao's answer here:
Are there APIs for custom vibrations in iOS?
but unfortunately AudioServicesPlaySystemSoundWithVibration private function was only usable in iOS 6.
so is there any other possible way?
You need AudioServicesPlaySystemSoundWithVibration API. But unfortunately it's private and you can not publish your app :(
Check this blog post and this answer