The problem with your app not being able to find the audio files most likely has nothing to do with your code.
Are the audio files in the Resources folder in the app bundle? If they are not, your code will not be able to find and load them.
Make sure the audio files are in the app target's Copy Bundle Resources build phase. The files must in this build phase to get copied to the Resources folder in the app bundle when you build the project.
Take the following steps to look at the files in the Copy Bundle Resources build phase.
Open the project editor by selecting the project file from the left side of the project window.
Select the app target from the target list on the left side of the project editor.
Click the Build Phase button at the top of the project editor.
Click the disclosure triangle next to the Copy Bundle Resources build phase.
If your audio files are not in the Copy Bundle Resources build phase, click the Add button below the list of files to open a sheet where you can choose the files to add to the build phase.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: