I have an xib file which is a custom cell that is being loaded programmatically onto the tableview on the view controller. However, it never runs the function didSelectRowAt
and print to the console.
Assuming functions like numberOfRows(in section:)
and cellForRow(at indexPath:)
are working, it seems that your UITableView
's dataSource
is set to ThumbnailViewModel
, but not your UITableView
's delegate
property.
Wherever you've set dataSource
be sure to set your UITableView
's delegate
property to be the ThumbnailViewModel
.
Real cause:
Try changing func tableView(_ tableView: UITableView, didSelectRowAt indexPath: NSIndexPath)
to func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)