Search code examples
iosswiftnsurl

Convert mp3 file into URL in swift


I have sound files (mp3 and m4a) that I imported into my xCode project that I need to convert into URLs.


Solution

  • You can use URLForResource:

    if let audioURL = Bundle.main.url(forResource: "audioName", withExtension: "mp3") {
        print(audioURL) 
    }