On Xcode 16 (16A242) app execution and UI will stall / lag as soon as an AVAudioPlayer is initialized.
let audioPlayer = try AVAudioPlayer(contentsOf: URL)
audioPlayer.volume = 1.0
audioPlayer.delegate = self
audioPlayer.prepareToPlay()
Typically you would not notice this in a music app for example, but it is especially noticable in games where multiple sounds are being played using multiple instances of AVAudioPlayer. The entire app slows down because of it.
This is similar to this issue from last year.
I have reported it to Apple in FB15144369, as this messes up my production games where fps goes down to nothing when sounds are enabled.
Unfortunately I cannot find a solution. Anyone?