Is it possible to use the existing Apple system sounds in my own app? I would like to write a sample app in Swift that does the following steps:
Here's a quick way to test the sounds.
import AVFoundation
func displaySoundsAlert() {
let alert = UIAlertController(title: "Play Sound", message: nil, preferredStyle: UIAlertController.Style.alert)
for i in 1000...1010 {
alert.addAction(UIAlertAction(title: "\(i)", style: .default, handler: {_ in
AudioServicesPlayAlertSound(UInt32(i))
self.displaySoundsAlert()
}))
}
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
}