I'm trying to play some small .wav files using AudioToolBox library, but I just can't get the url for the files that I dragged into the project folder (the folder which contains the classes, etc.)
if let soundUrl = Bundle.main.url(forResource: name, withExtension: "wav") {
//make use of AudioServicesCreateSystemSoundID...
}
else {
print("sound wasn't found")
}
I tried all combinations of possible drags to xcode (Copy itens if needed, Create groups, Create folder references) and very frequently I Clean the project, but still I always get "sound wasn't found". I truly don't know what information to give, but my approach was working until some days ago, then it suddenly stopped...
PS: Not sure if it's a useful information but I printed the list of files at Bundle.main.bundlePath and I didn't find any of the files I wanted, although they all appear in the list of files in the left (that contains codes, xcassets, Main.storyboard, etc.)