I need to make the iPhone vibrate, but I don\'t know how to do that in Swift. I know that in Objective-C, you just write:
import AudioToolbox
AudioServicesPl
You can vibrate the phone using either AudioServices or Haptic Feedback.
// AudioServices
AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))
// Haptic Feedback
UIImpactFeedbackGenerator(style: .medium).impactOccurred()
Checkout my open source framework Haptica, it supports both Haptic Feedback, AudioServices and unique vibrations patterns. Works on Swift 4.2, Xcode 10