If you need to display scrolling elements dynamically, you should check if they are lists or grids. Lists are vertical, and grids can be vertical or horizontal. In lists, only 1 cell can be in a column but for Grids, it can be more than 1 cell in a column. Here is an example of both of them:
This page is created for grids.
If you need to display scrolling elements dynamically, you should check if they are lists or grids. You can find how to understand the difference here. If you have decided that you want to create Grids, this is the right place to read.
An example of a grid is below. In the image, the cell prototype repeats itself with different data inside.
Grids have different names in iOS and Android. Grids are explained below with the code and details.
Generated code for iOS/Android and Details
CollectionView (Horizontal / Vertical)
A grid is called CollectionView in Swift language.
A CollectionView object is responsible for managing an ordered collection of data items and presenting them in customizable layouts.
It has two directions as Vertical and Horizontal. You can select the one that fits your case. In the case below, you can see the CollectionView-Vertical and its generated code.
importUIKitclassPictureCollectionViewCell:UICollectionViewCell {// MARK: - Properties@IBOutletprivateweakvar pic03ImageView: UIImageView!overrideinit(frame: CGRect) { super.init(frame: frame) self.setupViews() }requiredinit?(coderaDecoder: NSCoder) { super.init(coder: aDecoder) }funcsetupViews() {//The properties of the code are defined in Storyboard. }}
RecyclerView-GridLayoutManager
⚠️This feature is available in only Mac App. Web App support for Android is coming soon.
If you need to install the desktop app, click here.
GridLayoutManager is the RecyclerView.LayoutManager implementation that shows items in a grid. It is responsible for managing an ordered collection of data items and presenting them in customizable layouts.
It has two directions as Vertical and Horizontal. You can select the one that fits your case. In the case below, you can see the GridLayoutManager-Vertical and its generated code.
Let's see the generated code for GridLayoutManager.