@Juan-GH Have you found anything on using NSCollectionLayoutGroup.custom? I also am trying to do this myself to make a timeline where my cells are seperated based on amount of time passing between them. Let me share what I believe to be true.
As you may or may not know, you have to fill out a NSCollectionLayoutGroupCustomItemProvider closure for your group. This closure gives you the enviroment as parameters but no reference to the indexpath or anything regarding which cells you are providing.
This leads me to believe that NSCollectionLayoutGroup's, even custom ones, do not want to use any information in your data model. They will not lay themselves out differently because they are laying out some cells instead of others. For instance, here is my attempt
let mainGroup = NSCollectionLayoutGroup.custom(layoutSize: mainGroupSize) { env in
var frame = CGRect(x: 0,y: 0,width: self.cellWidth,height: self.collectionView.frame.height)
let firstDay = self.days[0].date // This probably doesn't work
var items = [NSCollectionLayoutGroupCustomItem(frame: frame)]
for day in self.days {
let dayDiff = day.date.days(from: firstDay)
frame.origin.x = self.cellWidth * CGFloat(dayDiff)
items.append(NSCollectionLayoutGroupCustomItem(frame: frame))
}
return items
}
As you can see this loops through my classes self.days and writes out all of the items based on their time difference from the start date. However you can see that its writing out all of the days in every single group. That means if this was in a nested group, it would just replicate the data across every group. I don't know of a way to "pickup where you left off". So yeah, I don't think this is how you do this. Its possible that I am confusing the concept of a group with a section.
And yeah there is basically no information on NSCollectionLayoutGroup.custom online. I would suggest googling that or NSCollectionLayoutGroupCustomItemProvider