Scrollable lists using Protocol-Oriented Programming and UICollectionViewCompositionalLayout
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.
- Writing an abstraction of the data type of scrolling elements;
- Writing a base class for scrollable elements;
- Writing an Implementation for Lists;
- Use cases