-
Notifications
You must be signed in to change notification settings - Fork 30
TableAdapter and CollectionAdapter are now open for sublclassing #6
Comments
Also why not to use performBatchUpdates on tableView here instead of begin/end updates?
|
And thanks a lot for your awesome job 👍 |
I second this idea. Right now I kind of divide this logic by either creating an extension of my viewcontroller(s) in separate file (with the director logic there) or a separate class for managing a director. |
@crabman448 It's a nice idea but what you need specifically? public class ArticleAdapter: TableAdapter<Article,TableArticleCell> {
init() {
super.init()
self.on.dequeue = { ctx in
ctx.cell?.titleLabel?.text = ctx.model.title
ctx.cell?.subtitleLabel?.text = ctx.model.text
}
self.on.tap = { ctx in
print("Tapped on article \(ctx.model.id)")
return .deselectAnimated
}
}
} |
@crabman448 regarding the |
@malcommac |
In the example project the sources of the FlowKit are in the same module and that's why you can subclass it, I suppose |
Yeah I think you're right; it should be enough to mark the class as |
I think it should be enough 👍 |
975be47 TableAdapter and CollectionAdapter are now open for subclassing |
My suggestion is to add possibility to subclass TableAdapter or CollectionAdapter in order to create our own subclasses for specific cells and models. This way we will be able to separate this logic from the controller to different class and reuse this class everywhere. Of course, we can create a factory for often used adapters and return them from it. But it seems to be clearer and easier to subclass and then use it.
To make it kind of like this:
What do you think about this idea?
The text was updated successfully, but these errors were encountered: