When you look for a way to play audio in your iOS application you usually find code like this player = try AVAudioPlayer(contentsOf: url) player.prepareToPlay() player.play() While this code works and will play the given audio file it does not deal with all the nuances of audio playback. Imagine the user is playing a podcast or music, do you want the sound in your app to stop that playback? Or play over it? The key to correct audio playback is understanding AVAudioSession categories. Let’s ...