I have an app that locally prints out all of a users songs in a list.
This is the array:
var mySongs: [MPMediaItem] = []
This is how the songs are fetched:
self.mySongs = MPMediaQuery.songs().items ?? []
I want to loop through the mySongs array and add specific songs from it into newArray
for songs in mySongs{
if songs.title == "Actin Crazy"{
newArray[counter] = songs
counter+=1
}
}
But I am getting this error: Thread 1: Fatal error: Index out of range
How do I figure out how/where its going out of range in order to fix this?