Medium Apr 11, 2024

How to do pagination in SwiftUI

Article Summary

Medium's iOS team rebuilt their search feature in SwiftUI and needed infinite scroll. Here's the elegant pagination pattern they landed on after years of iteration.

Thomas Ricouard from Medium Engineering shares the production-ready pagination technique they use across the Medium iOS app. It's a generic, reusable approach that handles loading states, error cases, and prevents duplicate requests.

Key Takeaways

Critical Insight

A battle-tested SwiftUI pagination pattern that separates state management from content rendering and keeps working even when users navigate away.

The article reveals a subtle but critical difference between .onAppear and .task that changes how pagination behaves when users switch contexts.

Recent from Medium

Related Articles