Convenience API for playing iOS system sounds
I made this for personal use, but feel free to use it or contribute.
// AudioToolbox
AESound().playSystemSound(.uisounds_go_to_sleep_alert)
// AVFoundation
let output = AESound()
let path = SystemSound.uisounds_go_to_sleep_alert.rawValue
output.prepareSound(atPath: path)
output.playSound(atPath: path)
output.cleanupSound(atPath: path)
.Package(url: "https://github.com/tadija/AESound.git", majorVersion: 0)
- Manually: Add AESound.swift file into project.
This code is released under the MIT license. See LICENSE for details.