At WWDC 2019, Apple added a brand new API “UICollectionViewCompositionalLayout” to the UIKit. Using this powerful API, we can create complex compositional layouts without writing complicated code. At times, It feels tough to create complex collection view UIs using the UICollectionViewFlowLayout. The UICollectionViewCompositionalLayout API eases the process and guess what you can even support orthogonal scrolling UIs with much ease. Well, it sounds great, but practically we cannot use the UICollectionViewCompositionalLayout API until we drop the support for iOS 12.0 and earlier in our apps. (It is not going to happen for the next few years is what I predict.) So how do we use this API in iOS 12.0 and earlier?

IBPCollectionViewCompositionalLayout

Well, a friend of mine, Kishikawa Katsumi, had a solution for it! He claimed that his library IBPCollectionViewCompositionalLayout could use the same UICollectionViewCompositionalLayout APIs in iOS 12.0 and earlier. I was skeptical at first, but decided to give it a try. I installed it using Cocoapods, followed the instructions given, and boom! CompositionalLayouts started working on iOS 12.0 and earlier! Everything worked like magic.

I was amazed by the work he had done and decided to share this with the developer community. So here it is!

Do check out this excellent github library and share your thoughts in comments.

Credits

About the author