TableView returns nil when I try to reload it in a closure in another view controller. My aim is to update the tableView instantly when the data is changed.
I have a a static object in HomeVC:
static data: MyType = [] { ... didSet {
let storyboard = UIStoryboard(name: "Main", bundle: nil) let logsVC = storyboard.instantiateViewController(identifier: "LogsView") as? LogsViewController
logsVC?.updateUI(with: HomeViewController.data)
} }
And a func to update tableview in DetailVC:
func updateUI(with data: [MyType]) { self.tableView.reloadData() // this gives nil error on runtime. }