You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not the author, but I can let you know how we are working with this.
We add callbacks and things to our cell models for when certain subviews are tapped. We don't want the CellModel to know or care about the TableView or Hakuba... it is basically an inert object that just holds data.
So when we need to care about its index path and such, we deal with it at a different level. For example, one way we do it is like this:
privatefunc blogPostCellModel(blog:BlogPost, indexPath:NSIndexPath)->MYCellModel{letmodel=BlogPostCellModel(blog)
model.wasSelectedHandler ={[weak self]inself?.openBlogPostView(blog)self?.tableView.deselectRowAtIndexPath(indexPath, animated:true)}return model
}
Hopefully you can get something like this set up in your case as well. I personally don't think models should know about views, so this is one way we found to keep them separated (in the controller).
It is inconvenient to de-highlight row when a row has been selected
the cellModel has no information about the table and hakuba object, so it is hard to dehighlight the row after it has been selected.
The text was updated successfully, but these errors were encountered: