Simplifying Scrollable Lists with Protocol-Oriented Programming in Swift
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.