Skip to content

Instantly share code, notes, and snippets.

@pitt500
Created May 29, 2020 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pitt500/dbd05c667b563ebc08fb7a16b6c3bb23 to your computer and use it in GitHub Desktop.
Save pitt500/dbd05c667b563ebc08fb7a16b6c3bb23 to your computer and use it in GitHub Desktop.
struct TestPaginationView: View {
//1
@ObservedObject var viewModel = ItemListViewModel()
var body: some View {
NavigationView {
//2
ListPagination(items: viewModel.items, offset: 8, pagination: viewModel.getData) { item in
//3
Text("Item #\(item)")
}.onAppear {
//4
self.viewModel.getData()
}
.navigationBarTitle("Pagination Test")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment