Better Programming

Advice for programmers.

Follow publication

Member-only story

Super Easy Compositional UICollectionViews in Swift

Eric Yang
Better Programming
Published in
4 min readJul 15, 2020

--

Orthogonal scrolling collection view by Eric Yang

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

Photo by Joanna Kosinska on Unsplash

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…

--

--

Eric Yang
Eric Yang

Written by Eric Yang

Senior iOS engineer🚀, double degrees with Computer Science⚡Content writer? Why not!🚀

Write a response