0

I'm translating some code from Objective-C to Swift, but something isn't working. The code below is supposed to switch views and pass a String, however, nothing happens when a cell is tapped. I've embedded both ViewControllers with a NavigationViewController in Storyboard.

func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {

        var dvc : TemplateViewController = self.storyboard?.instantiateViewControllerWithIdentifier("TemplateViewController") as TemplateViewController
        dvc.tweet = self.templateList?.objectAtIndex(indexPath.row) as NSString
        self.navigationController?.pushViewController(dvc, animated: true)

}
SpaceShroomies
  • 1,635
  • 2
  • 17
  • 23

1 Answers1

-1

You need to explicitly write some methods in your TemplateViewController. Follow this SO answer Instantiate and Present a viewController in Swift

Community
  • 1
  • 1
Saify
  • 190
  • 10
  • He's got all the relevant parts of that in his example attempt. The most likely culprits are in the comments to his question. – David Berry Dec 17 '14 at 19:59