Reputation: 53
I am having an issue with swift 3 when I am trying to connect a Slide out Menu to another ViewController but I am getting an issue with the prepareforsegue.
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
{
let DestVC = segue.destination as! ViewControllerSlide
Here is where I am getting my error. ^^^
var indexPath : IndexPath = self.tableView.indexPathForSelectedRow!
DestVC.varView = indexPath.row
}
Upvotes: 1
Views: 2455
Reputation: 9923
Probably your segue is pointing to an UINavigationController
, try assign the destination with that first:
let destVC = segue.destination as! UINavigationController
let slideVC = destVC.topViewController as! ViewControllerSlide
//...
Upvotes: 7