I'm trying to rewrite my old player from Objective-C to Swift (by memory) and got in trouble. I've got array of songs like this
let query = MPMediaQuery.songsQuery()
query.groupingType = MPMediaGrouping.Title
songsArray = query.collections
Next in my table view I'm trying to get the name of each media item to put in the cell.textLabel
. Like this:
var mediaItem = songsArray.objectAtIndex(indexPath.row)
var title = mediaItem.valueForProperty(MPMediaItemPropertyTitle)
But I'm not getting MPMediaItems, I'm getting the collection of items. So how can I take MPMediaItem from array of MPMediaItemCollections and get the title?