What would be best way to create a pagination engine architecture ?
In my previous implementation I'd
- UIViewController
- property UITableView
- with two sections in tableView. One for normal display and other
- for PaginationCell
- and rest of the business logic how to enable and hide indicator View
We thought this is a too much of duplicate code for every feature and decided to remove duplicate code.
And we wrote a category on UIViewController
to handle data pagination. Now we handle all calculation inside the category using scrollViewDidScroll
and add indicator footer view using objc_setAssociatedObject
.
I believe Associated objects
should be seen as a method of last resort, rather than a solution in search of a problem (and really, categories themselves really shouldn’t be at the top of the toolchain to begin with).
So my question is that - Is this new design a best solution for the problem. Or would you recommend some better approach ?