I'm creating a simple game in Swift. If the time is almost over (5 seconds) I would like to vibrate the phone.
When 5 or 4 seconds left: normal vibration with AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) once per second.
Question 1:
When 3 or 2 seconds left: short vibration, twice per second. When 1 second left, short vibration, thrice per second.
Question 2:
When 0 seconds left, vibrate for 2 or 3 seconds.
Is this possible? How can I change the duration of the vibration? I read online that increasing the duration of the vibration is not allowed, thats fine for me, but can I decrease the duration?
I have already checked How to make iPhone vibrate using Swift? but this question from 2014 did not cover Swift 3 or 4. If I try to play the sound 1519, 1520 or 1521 it just does nothing. The answer posted by Malmer only targets iPhone's with a haptic feedback. I want to find a solution for the iPhone 6s and lower, since they still run the newest iOS (11) and are able to run short vibrations when you're browsing through the iOS Settings for notification sounds.