let path = Bundle.main.path(forResource: "bang.wav", ofType:nil)!
let url = URL(fileURLWithPath: path)
let sound = try AVAudioPlayer(contentsOf: url)
I found this nice example code for playing a sound. Question not answered there: where does bang.wav need to be located in order to be found by Bundle.main.path during development and debugging? If MacOS and iOS answers are different, both are of interest.