0

I am trying to create a horizontal list of images with the same size (red tiles), and the last item should be a "view all" cell with a different width (purple tile):

enter image description here

I've been struggling to implement this using UICollectionViewCompositionalLayout, I can't find the right combination of groups and items.

Would it make sense to create a group with a number of items equal to the images in my datasrouce?

let group = NSCollectionLayoutGroup.horizontal(layoutSize: size, subitem: item, count: data[section].count)

and then add one last group for the purple tile?

let group = NSCollectionLayoutGroup.horizontal(layoutSize: purpleSize, subitems: [purpleItem])

and even if this the case, how would I combine these two together?

You don't have to provide any code samples, just describing the setup of nested groups would be enough! Thanks in advance!

phi
  • 10,634
  • 6
  • 53
  • 88

1 Answers1

0

If you create single layout item with estimated width, then that along with different cell types and constraints should give you this result. And you won't have to reach into datasource from your layout setup.

Another approach you could try is to setup the subitems array like this: [red, red, red, red, purple]

Filip
  • 1,824
  • 4
  • 18
  • 37