Scrollable lists using Protocol-Oriented Programming and UICollectionViewCompositionalLayout

Boris Bugor
8 min readAug 26, 2023
Photo by Mika Baumeister on Unsplash

I continue the series of articles devoted to the use of a protocol-oriented approach when scaling projects with a large code base.

If you have not read the previous article, then I strongly recommend that you familiarize yourself with the approaches and conclusions that were made in it. Briefly, a case was considered with the creation of a universal class that would allow creating a constructor for using scrolling lists based on UICollectionViewFlowLayout.

The motivation for this approach is very simple, we want to reduce the amount of boilerplate code by creating universal tools that will reduce the amount of routine and at the same time not lose flexibility.

In this article, we will continue to consider a similar task using UICollectionViewCompositionalLayout, which is supported from iOS 13+, and see what nuances this framework brings.

As in the previous problem, we will solve this problem in 4 stages.

  1. Writing an abstraction of the data type of scrolling elements;
  2. Writing a base class for scrollable elements;
  3. Writing an Implementation for Lists;
  4. Use cases

1. Abstract scrolling…

--

--

Boris Bugor
Boris Bugor

Written by Boris Bugor

Indie iOS Developer | Entrepreneur | Dreamer

No responses yet