Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Which is better uicollectionview or uitableview in ios?


Asked by Lennon Marsh on Dec 13, 2021 iOS Development Manual



In WWDC 2020, Apple pushes the usability of UICollectionView to the next level by introducing the list layout in UICollectionView. By using the new features and APIs given to UICollectionView in iOS14, it is now super easy to build a UITableView -like list, making it arguably the better option when compared to UITableView.
Additionally,
With iOS 13, Apple introduced UICollectionViewCompositionalLayout, a new API for building complex layouts. In iOS 14, Apple has added: This enables you to create a list layout in one line of code, without the need for detailed knowledge of the UICollectionViewCompositionalLayout API.
Furthermore, But this year, UICollectionView has gained a remarkable number of new features when it comes to building lists, and is now arguably the better option in the vast majority of situations. Let’s take a first look at some of those new APIs, and how we can get started using them by building a simple collection view-powered list.
Subsequently,
Since the layout is predefined, the SDK component takes care of most of the layout and provides delegates that are mostly focused on displaying cell content. UICollectionView, on the other hand, provides maximum flexibility as the layout is fully customizable.
In respect to this,
With the cell registration in place, we can use it to define the data source of our collection view. First, let’s define a UICollectionViewDiffableDataSource instance variable with Section as the section identifier type and SFSymbolItem as the item identifier type. var dataSource: UICollectionViewDiffableDataSource<Section, SFSymbolItem>!