Hi ! I was recently asked to make the iPhone vibrate while using the app (not by notification). It’s been a while since I had to do it and back then it was in Obj-C. Here’s how to achieve it in Swift:
1 2 3 4 5 6 7 8 9 10 |
import UIKit import AudioToolbox class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate)) } } |
Cheers,
MAB