getting Thread 1: EXC_BAD_ACCESS (code=1, address=0x48) in simulators and real device on this line player = try! AVAudioPlayer(contentsOf: url!)

Change line 14 to var player : AVAudioPlayer?
and body of playSound to:
let url = Bundle.main.url(forResource: soundName, withExtension: "wav")
player = try? AVAudioPlayer(contentsOf: url!)
player?.play()
getting Thread 1: EXC_BAD_ACCESS (code=1, address=0x48) in simulators and real device on this line player = try! AVAudioPlayer(contentsOf: url!)

Change line 14 to var player : AVAudioPlayer?
and body of playSound to:
let url = Bundle.main.url(forResource: soundName, withExtension: "wav")
player = try? AVAudioPlayer(contentsOf: url!)
player?.play()