How to use an AVAudioPlayer in iOS with Swift 5

If you write an app that should play sound here is a snippet for you import AVFoundation var player: AVAudioPlayer? let url = Bundle.main.path(forResource: “richtig”, ofType: “wav”) do { try AVAudioSession.sharedInstance().setMode(.default) try AVAudioSession.sharedInstance().setActive(true, options: .notifyOthersOnDeactivation) guard let url = url else { return } player = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: url)) } catch { print(“Something went…