I'm trying to store my sounds in a separate folder called sounds but as I've limited experience with Swift I'm not sure how to concatenate the directory location, so instead of just storing my sounds in the root directory of my project, I'd like it to have a separate folder.
My current code is:
func setupAudioPlayerWithFile(file: NSString, type: NSString) -> AVAudioPlayer? {
let path = NSBundle.mainBundle().pathForResource(file as String, ofType: type as String)
let url = NSURL.fileURLWithPath(path!)
var audioPlayer: AVAudioPlayer?
if path != nil {
do {
try audioPlayer = AVAudioPlayer(contentsOfURL: url)
} catch {
print("Player not available")
}
}
return audioPlayer
}
So, instead of just dropping my sounds in the root directory, how do I code it so I can have 'Sounds/sound_one.mp3'
Thanks