HomeiOS Developmentios - ProgressView not exhibiting in SwiftUI Record after first time

ios – ProgressView not exhibiting in SwiftUI Record after first time


I’ve a paginated listing that has a ProgressView as its final subview. When reaching the underside of the listing the ProgressView triggers a process that masses extra outcomes from the distant server and the person can proceed scrolling. This works superb the primary time (and typically the second time), nevertheless, after this, the progress view isn’t seen anymore.

Record {
    Part {
        ForEach(0...10) { i in
            Textual content("(i)")
              .body(maxWidth: .infinity, alignment: .middle)
        }
    }
    if viewModel.hasMoreToLoad {
        Part {
            ProgressView()
              .body(maxWidth: .infinity, alignment: .middle)
              .process { await viewModel.loadMore() }
        }
    }
}

The identical will be noticed with a conditional ProgressView inside a Record

Record {
    if viewModel.isLoading {
        Part {
            ProgressView()
              .body(maxWidth: .infinity, alignment: .middle)
        }
    } else {
        Part {
            ForEach(0...10) { i in
                Textual content("(i)")
                  .body(maxWidth: .infinity, alignment: .middle)
            }
        }
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments