im currently writing an app but can't figure out how to translate this particular Objective-C line into swift. Any help will be much appreciated. I've been able to translate other lines just fine but this one throws some exception error. Here's the original Objective-C line: 

> 
> MPMediaItem \*rowItem = [songs objectAtIndex: indexPath.row]; 
> 
> 
> 

I'm a noob and have tried many variations including: 

> 
> var rowItem = songs.objectAtIndex(indexPath.row) as MPMediaItem
> 
> 
> 

and 

> 
> var rowItem: MPMediaItem = songs.objectAtIndex(indexPath.row) as MPMediaItem
> 
> 
> 

But I've been at this so long I can't see what it should be. Many thanks!

edit:

songs is defined as: 

> 
> let songsQuery = MPMediaQuery.songsQuery()  
> 
>  let songs = [songsQuery.items] as NSArray 
> 
> 
> 

i just receive an exe\_breakpoint error. I can get past this if i encapsulate the MPMediaItem in an array by using ... as [MPMediaItem] but then i can't get the property values e.g. MPMediaItemPropertyTitle and MPMediaItemPropertyArtist.

update:
managed to get it working by using a for loop to obtain the MPMediaItemPropertyTitle and MPMediaPropertyArtist. The 'songs' variable is defined as i have written above. @Antonio, removing the brackets did not work. This is my current code: 

```
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell

    // Configure the cell...

    let songsQuery = MPMediaQuery.songsQuery()
    let allSongsArray = [songsQuery.items] as NSArray

    var singleItem: AnyObject = allSongsArray[indexPath.row]

    var rowItem = singleItem as [MPMediaItem]

    if rowItem.count > 0 {

        cell.textLabel?.text = rowItem[0].valueForProperty(MPMediaItemPropertyTitle) as NSString
        cell.detailTextLabel?.text = rowItem[0].valueForProperty(MPMediaItemPropertyArtist) as NSString
    }

    return cell
}

```

The problem i have now is when i test the app, it only displays the very first song in my library and does not list every song like it is supposed to. Thank you for any help you can provide!

UPDATE 2: 

Got it working with the following code: 

```
class SongsViewController: UITableViewController {

var allSongs : [MPMediaItem] = []

override func viewDidLoad() {
    super.viewDidLoad()

    // Uncomment the following line to preserve selection between presentations
    // self.clearsSelectionOnViewWillAppear = false

    allSongs += MPMediaQuery.songsQuery().items as [MPMediaItem]
    println(allSongs.count)

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem()
}

override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    // #warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 1
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    // #warning Incomplete method implementation.
    // Return the number of rows in the section.

    return allSongs.count
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell

    // Configure the cell...

    var rowItem = allSongs[indexPath.row]

    cell.textLabel?.text = rowItem.valueForProperty(MPMediaItemPropertyTitle) as NSString
    cell.detailTextLabel?.text = rowItem.valueForProperty(MPMediaItemPropertyArtist) as NSString

    return cell
}

```