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