I've read in some forums that UICollectionView is better than UITableViewController when displaying feeds, some like Twitter feed or Medium feed.
Is that true? And if it is why should we use Collections over tableViews?
Thanks for your pov
I've read in some forums that UICollectionView is better than UITableViewController when displaying feeds, some like Twitter feed or Medium feed.
Is that true? And if it is why should we use Collections over tableViews?
Thanks for your pov
[Your question is a possible duplicate of this one here: When to use UICollectionView instead of UITableView? but I decided to give you a short overview here.]
That's kind of true. It always depends on your use case and UI. In the end you can also use a UICollectionView
to build your Table. It's all just easier one way sometimes. And sometimes not possible with one of them.
This is how Apple would describe it:
UITableView Displays hierarchical lists of information and supports selection and editing of the information. Apple Developer Documentation - UITableView
UICollectionView Manages an ordered collection of data items and presents them using customizable layouts. (Apple Developer Documentation - UICollectionView)
To answer your question:
I would mostly use a UITableView
because they do a great job in displaying lists of information. But if you see it's going to be more complex, use UICollectionView
. There is a good YouTube video series on how to customize them to build a twitter news feed. It's a good example of how to use it and when to use it. Check it out
To sum up:
UICollectionView
for more complex and advanced things where you need a lot of customization.UICollectionView
for things that are placed in a grid with for example three pictures in every row.UITableView
for simple and advanced lists but not necessarily if you need a feed like twitter uses (to point out an example).Keep in mind that you can use custom cells (with or without XIB files) in a UITableView
!
However just choose the way you are most comfortable with.