I have an application that displays data in tableview cell and not I want to be able to call the addText viewcontroller
when I select the cell and I want to pass the text value in the cell to the text field in the addText viewcontroller
below is what I have tried but the app crashes everytime I select the cell
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let list = items?[indexPath.row]
print("SELECTED ROW \(list?.name)")
let storyBoard: UIStoryboard = UIStoryboard(name: "AddListSB", bundle: nil)
let newViewController = storyBoard.instantiateViewController(withIdentifier: Constants.ADD_LIST_SB) as! AddListVC
newViewController.titleTxtField.text = list.title
self.present(newViewController, animated: true, completion: nil)
}
it prints the right text in the console though before crashing and does not give the Viewcontroller