Let’s Create a Complex UI with CompositionalLayout for iOS

Esat Kemal Ekren
4 min readNov 7, 2022

I haven’t been writing for a long time. I’m sorry for that. After now, I’m gonna be more active in Medium.

Here is what we are going to build;

Complex E-Commerce View

Let’s start. I’m going to use UICollectionViewCompositionalLayout to create these views. Apple announces this amazing component in iOS 13. So your development target should be iOS 13 or higher.

First, I would like to mention about project structure. I prefer the MVVM design pattern in this project. Also, create all views programmatically. I use SnapKit for layout :)

Here are the components of our projects

The structure is straightforward, but I would like to explain what I did for preparation. First, I created all related models, ViewModel, and mock data. Then I connected them to Controller. I didn’t use any network calls because our main focus is creating a layout.
Let’s look at Some of CollectionView Cell.

--

--