Ornella SOH
Ornella SOH

Reputation: 1

Table view reload everything

I just wanted the "validate" button to take me back to the home page, but every time I go to the sound library, the themes reload again and again. How can I fix this? f

//FUNCTION THAT GETS THE NAME OF THE SONGS
func gettingSongNames()
{
    let folderURL = URL(fileURLWithPath:Bundle.main.resourcePath!)

    do
    {
        let songPath = try FileManager.default.contentsOfDirectory(at: folderURL, includingPropertiesForKeys: nil, options: .skipsHiddenFiles)

        //loop through the found urls
        for song in songPath
        {
            var mySong = song.absoluteString

            if mySong.contains(".mp3")
            {
                let findString = mySong.components(separatedBy: "/")
                mySong = findString[findString.count-1]
                mySong = mySong.replacingOccurrences(of: "%20", with: " ")
                mySong = mySong.replacingOccurrences(of: ".mp3", with: "")

                songs.append(mySong)
            }

        }


    }

    catch
    {
        print ("ERROR")
    }
}

}

Upvotes: 0

Views: 13

Answers (0)

Related Questions