This is a sample application of LIST that implements pagination with loading
- Xcode 11 beta
- iOS 13.0 beta
- SwiftUI
use UIViewRepresentable
struct LoadingView: UIViewRepresentable {
var isLoading: Bool
func makeUIView(context: Context) -> UIActivityIndicatorView {
let indicator = UIActivityIndicatorView(frame: .zero)
indicator.style = .large
indicator.hidesWhenStopped = true
return indicator
}
func updateUIView(_ view: UIActivityIndicatorView, context: Context) {
if self.isLoading {
view.startAnimating()
} else {
view.stopAnimating()
}
}
}
LoadingRow
struct LoadingRow : View {
@State var isLoading: Bool
var body: some View {
HStack {
Spacer()
LoadingView(isLoading: isLoading)
Spacer()
}
}
}
SwiftUI-List-Pagination is released the MIT license.