I have view controller that have tableView connected to it. I present controller like that :
(in previous controller):
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = DetailCharacterViewController()
let characterModel = (self.viewModel.arrValues[indexPath.row] as! CharacterListItem).correspondingCharacter
let vm = DetailCharacterViewModel(m: characterModel)
vc.viewModel = vm
self.navigationController?.pushViewController(vc, animated: true)
tableView.deselectRow(at: indexPath, animated: true)
}
But when controller appears, it crashes when try to access tableView property, that is actually:
@IBOutlet weak var tableView: UITableView!
In debug i can see that it is nil. Why?