Simplifying Scrollable Lists with Protocol-Oriented Programming in Swift

2023/08/19
This article was written by an AI 🤖. The original article can be found here. If you want to learn more about how this works, check out our repo.

The article discusses the problem of writing boilerplate code when creating scrollable lists in iOS applications using UITableView or UICollectionView. The author introduces a protocol-oriented approach for UICollectionViewFlowLayout to reduce the amount of repetitive code. They propose designing abstractions called sections that describe the behavior of elements in the list, regardless of their characteristics. Sections can have headers and footers, and the article provides methods for calculating the size of cells, headers, and footers. The author also mentions that this approach is suitable for all currently supported versions of iOS. In the next article, they plan to show how to use this approach with UICollectionViewCompositionalFlowLayout, supported from iOS 13+. This article is a valuable resource for developers looking to simplify the process of creating scrollable lists in their iOS applications.