JALURI 17,453 SUMMARIES / 50 SOURCES
SEARCH LAST PASS 07:00 ATOM

How to do pagination in SwiftUI

The Medium iOS app uses SwiftUI for paginated lists by lazily loading content and handling various states like loading and errors.

MAIN POINTS
  1. SwiftUI is used to paginate lists in the Medium iOS app.
  2. A generic container view handles different states like loading and errors.
  3. Lazy loading with `.onAppear` triggers data fetching for pagination.
TAKEAWAYS
  1. Pagination is achieved by showing a progress indicator and fetching the next page's data on appearance.
  2. Using `.onAppear` instead of `.task` ensures the task continues even if the view is off-screen.
  3. A generic search results screen manages different entities uniformly with a consistent codebase.
READ THE ORIGINAL