Newbie Swift/SwiftUI developer here.
I'm adding row seperators to a LazyVStack, and avoiding the last row by capturing the last item and comparing each item at render time.
LazyVStack( alignment:.leading, spacing: 6 ) {
let lastItem = document.data.research.competition.last
ForEach( document.data.research.competition ) { item in
DownloadPreviewRow(title: item.title, tagline: item.slogan, price: item.price )
if item != lastItem { Divider() }
}
}
But I can't figure out how to apply this to a LazyVGrid when using Adaptive GridItems for the columns, does anyone have any suggestions? Basically, I don't know how many cells are in a row, and even if I did, the lack of an index makes it harder.
I have tried searching online, but it appears that my GooglFu might be too weak.
LazyVGrid( columns: [GridItem( .adaptive(minimum: 300, maximum: 450))] ) {
ForEach( document.data.research.competition ) { item in
AppStorePreviewCell(title: item.title, tagline: item.slogan, price: item.price )
}
}