I created an Affirm bare bone skeleton App with Swift
I opened up the Affirm App on my iPhone the other day and I wondered to myself, “How do they implement the UICollectionView on the Home Page for the Special Offers???”
I decided to recreate the app with a un-stylized UI (I also wanted to take a short break on working on my app, it is near complete 🤙🏽).
The main focus wasn’t really the UI but for the knowledge of how to implement a horizontal UICollectionView within a UIViewController. I’ve seen it in many apps, I sort of figured it would be a nice thing to know and a nice skill to have in my arsenal 🔫.
Three days later with 4 hours put into each day on each view controller, here is the result.
My solution to this was to create a UIStackView with three items. Which included a custom UIViewController on the top and bottom of the stackview and a Custom UIView in the middle that inherited from UICollectionViewDataSource, UICollectionViewDelegate, and UICollectionViewDelegateFlowLayout. Within the UIView included a declaration of a UICollectionView variable to allow me to generate the collectionview as I would as if I created a UICollectionViewController class. I left the presented ViewControllers blank on the tap of a cell and tap of a button just to show the functionality of the app itself.
Github Link: Just in case you want to see the code.
Possible Video in the making on how to achieve this. Stay Tune.