Member-only story
Super Easy Compositional UICollectionViews in Swift
Creating an orthogonal scrolling page is super easy with the modern compositional layouts in iOS 13+

In this article, I’ll be demonstrating how easy it is to create an orthogonal scrolling page by using UICollectionViewCompositionalLayout
. We will have a detailed look of the view hierarchy to learn the core concepts of modern collection view in iOS 13, and build an orthogonal scrolling collection view step by step.
1. The Old Days of Using Nested UICollectionViews
Through the years, iOS developers strive to achieve cross-scrolling pages like Apple does within their App Store. Developers are impressed by how Apple mixes the horizontal scrolling and vertical scrolling within the same page.
Before iOS 13 was released, there was only one way to achieve this: wrapping the UICollectionView
instance within the UICollectionViewCell
of another UICollectionView
. It certainly can be within an UITableViewCell
; it just depends on whether you’re using an UICollectionView
or UITableView
as the parent view. But normally…