Is it possible to play already existing system sounds without importing your own?
For Swift
import AVFoundation
func play(sound: String) {
var soundID: SystemSoundID = SystemSoundID()
let mainBundle = CFBundleGetMainBundle()
if let ref = CFBundleCopyResourceURL(mainBundle, sound as CFString, nil, nil) {
AudioServicesCreateSystemSoundID(ref, &soundID);
AudioServicesPlaySystemSound(soundID);
}
}
the implementation of @Krishnabhadra