Reputation:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showView"
{
var upcoming: NewViewController = (segue.destinationViewController as? NewViewController)!
let indexPath = self.tableView.indexPathForSelectedRow!
let titleString = self.objects.objectsAtIndexes(indexPath.row) as? String
upcoming.titleString = titleString
self.tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
}
I am getting the following error
Cannot convert value of type 'Int' to expected argument type 'NSIndexSet'..
in the line where I am trying to convert the value into string:
let titleString = self.objects.objectsAtIndexes(indexPath.row) as? String
Upvotes: 1
Views: 5960
Reputation: 3690
let titleString = self.objects.objectsAtIndexes(indexPath.row) as? String
You are asking for objects at indexes , but what you really want is object at index
you could just use self.objects[indexPath.row]
Upvotes: 1