paololeonardi / WaterfallGrid

A waterfall grid layout view for SwiftUI.
MIT License
2.39k stars 117 forks source link

Span over columns #66

Closed MKGitHub closed 2 months ago

MKGitHub commented 1 year ago

Hi, is there a way to span a cell over multiple columns? For example, I want 2 cells, and then 1 cell that spans over all columns…

1 2 -3- 4 5

thx

paololeonardi commented 1 year ago

Hi @MKGitHub , it's not possible to create that layout with a single grid. But you could technically achieve the same result if you use two different grids and separate them by a custom view that represents the cell 3:

eg:

ScrollView {
  WaterfallGrid(RectanglesArrayOne, content: RectangleView.init)
  CustomCellView3()
  WaterfallGrid(RectanglesArrayTwo, content: RectangleView.init)
}

note if you are not interested in the irregular layout WaterfallGrid gives you. Grid might be a better tool for you.