Skip to content

mcz9mm/SwiftUI-List-Pagination

Repository files navigation

SwiftUI-List-Pagination

platform ios swift Swift twitter

This is a sample application of LIST that implements pagination with loading

Requirement

  • Xcode 11 beta
  • iOS 13.0 beta
  • SwiftUI

Screenshot

Jun-17-2019 09-23-52 1

Detail

Loading View

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()
        }
    }
}

License

SwiftUI-List-Pagination is released the MIT license.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages