question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trigger for calling loadNext() on iOS

See original GitHub issue

The sample that’s in repo has following (for table view)

    if (indexPath.row == count - 1) {
      viewModel.pager.loadNext()
    }

In my SwiftUI iOS client right now I have

if data.shouldDisplayNextPage {
    nextPageView
}
                
....

private var nextPageView: some View {
    HStack {
        Spacer()
        VStack {
            ProgressView()
            Text("Loading next page...")
        }
        Spacer()
    }
    .onAppear(perform: {
        data.fetchNextData() 
    })
}                
              

data above is view model that calls in to shared KMP code. What I think I’m missing right now is how that shouldDisplayNextPage can be implemented. For example would it make sense to expose nextKey from Pager (or maybe there’s already some way to infer this?) Could also perhaps be returned from call to loadNext()?

If you like I can create PR with this change?

(note above client code is in https://github.com/joreilly/MortyComposeKMM/tree/multiplatform-paging …updated with 0.3.4 changes)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kuuuurtcommented, Feb 11, 2021

Whoops. Seems like the upload failed just for android. Could you try it again? I republished the same version

0reactions
joreillycommented, Feb 13, 2021

Changes have been merged to main branch of https://github.com/joreilly/MortyComposeKMM

Read more comments on GitHub >

github_iconTop Results From Across the Web

Communication triggers in Shortcuts on iPhone or iPad
Communication triggers in Shortcuts on iPhone or iPad. Use a communication trigger to run an automation when you receive an email or message....
Read more >
Flutter Live Objects/Collections - Amity Docs
It has loadNext() method to fetch more data. It also exposes hasNext property to check if next page or previous page is present....
Read more >
What triggers UITableView to load its data first time?
When you create a table view with a delegate and data source you can call reloadData on it to force it to go...
Read more >
TableView RxSwiftified way to detect Scroll reached ... - GitHub
I know the regular way of scrollviewdelegate and setting the delegate to trigger scrollviewdidscroll, However now i am using RxAlamofire and i ...
Read more >
Paginate data with query cursors | Firestore - Firebase
Return a subset of the data. Paginate query results. However, to define a specific range for a query, you should use the where()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found