I am getting exceptions on trying to dequeue reusable cells. It works fine when I set the initial scene arrow to points to the scene with the list view, but when I try to load the scene at runtime I get the exception
'unable to dequeue a cell with identifier SessionListTableViewCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
The exception happens here on the call to tableView.dequeueReusableCell
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "SessionListTableViewCell", for: indexPath) as? SessionListTableViewCell else {
fatalError("The dequed cell is not an instance of SessionListTableViewCell")
}
I am pretty sure that I have registered the cell type properly in IB. The correct cell type appears in IB as a child of the ListViewTableController and Content is set to Dynamic Prototypes.
It works if I set the initial scene arrow to point to the scene. It doesn’t work if I try to load the same scene at runtime. My Table View Cell Identifier seems to be properly configured in IB.
I was not able to register the cell type in code as I get getting a compile error here: tableView.register(SessionListTableViewCell.self, forCellWithReuseIdentifier: "SessionListTableViewCell") “Cannot invoke 'register' with an argument list of type '(SessionListTableViewCell.Type, forCellWithReuseIdentifier: String”