According to Apple\'s documentation, sound file in the ~/Library/Sounds will be search by system when trying to play a sound. How do I add a sound file to this folder?
I
I struggled with this as well. You have to create the Library/Sounds directory programmatically and move your custom sound into it.
let soundsDirectoryURL = fileManager.urls(for: .libraryDirectory, in: .userDomainMask).first!.appendingPathComponent("Sounds")
//attempt to create the folder
do {
try fileManager.createDirectory(atPath: soundsDirectoryURL.path,
withIntermediateDirectories: true, attributes: nil)
} catch let error as NSError {
print("Error: \(error.localizedDescription)")
}