Is there is a way to do pagination without using List in swiftUI. I found a couple solution but most of them are using list . In my code I don't have list so Im looking for a solution how can I use pagination without using List.
ZStack{
ActivityIndicator(isAnimating: $isAnimating)
ScrollView(.vertical, showsIndicators : true){
if isSelected == false {
ProductListSortFilterView()
}
LazyVGrid(columns: Array(repeating: GridItem(.flexible(),spacing: 5), count:2), spacing:10 ) {
ForEach(productListArray , id:.uid) { item in // MARK: Optinal typed changed
ZStack{
CatalogBackgroundView()
WebImage(url: URL(string: item.image?.medium ?? ""))
.resizable()
.aspectRatio(CGFloat(item.imageRatio ?? 0.6),contentMode: .fit)
.frame(width:UIScreen.main.bounds.width / 2.5,height:UIScreen.main.bounds.height / 6)
.padding(EdgeInsets(top: 0, leading: 0, bottom: UIScreen.main.bounds.height * 0.083, trailing: 0))
if item.isDiscountActive == 0 || item.isDiscountActive == nil || item.isDiscountDisplay == 0 {
Text("(item.priceSell ?? 0 , specifier: "%.2f" ) (item.targetCurrency ?? "") +VAT")
.font(.system(size: 12))
.bold()
.foregroundColor(.black)
.padding(EdgeInsets(top: UIScreen.main.bounds.height * 0.24, leading: 0, bottom: 0, trailing: 0))
}
}.onAppear {
if isFinish{
getProductList()
}
}
.onDisappear {
isFinish = false
productViewModel.currentPage = 0
}
}
question from:
https://stackoverflow.com/questions/65938311/scrollview-pagination-with-swiftui 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…