Registering multiple cells in UICollectionView (swift 3)

Viewed 9189

For UICollectionViews, is it possible to have multiple cell types?

For example:

media_cell

regular_cell

ad_cell

Would you just have to register them or do you have to include an if statement and change the layout according to some variable to achieve this effect.

For example:

if cell.ad == true {

}

The reason being, I want a slightly different sized cell for when an image is present. I guess resizing the cell could work but I haven't seen anything on this online.

Any suggestions

2 Answers
Related