Collection-View-in-a-Table-View-Cell icon indicating copy to clipboard operation
Collection-View-in-a-Table-View-Cell copied to clipboard

Why should UICollectionViewDataSource be in UIViewController instead of UITableViewCell ?

Open havelio opened this issue 3 years ago • 2 comments

Hi thanks for sharing, Would you tell me what the problem if we put UICollectionViewDataSource in the UITableViewCell ?

havelio avatar Mar 19 '21 03:03 havelio

Hey! It looks like this repo hasn't been updated for a while. That probably means the repo's not a high-priority for @ashfurrow. He'll answer this issue if he can, but just a head's up.

If you're using this project, you have the skills to improve it. If you've reported a bug, you are encouraged to open a pull request that fixes it. And of course, you're welcome to discuss with other developers in this repository's issues and pull requests. Have a great day!

Generated by :no_entry_sign: dangerJS

ashfurrow-peril[bot] avatar Mar 19 '21 03:03 ashfurrow-peril[bot]

It's a good question, and it's a matter of opinion, really. I believe that UITableViewCells should only be concerned with display logic. To make them the data sources for the collection view would violate the single-responsibility principle. You could do it – there's nothing stopping you – but I would recommend against it.

ashfurrow avatar Mar 19 '21 13:03 ashfurrow