Cash App Nov 10, 2022

Announcing Multiplatform Paging

Article Summary

Veyndan Stuart from Cash App just open-sourced a solution to one of mobile development's most annoying problems: writing pagination logic twice for Android and iOS.

Cash App released Multiplatform Paging, a Kotlin Multiplatform wrapper around AndroidX Paging that lets teams share pagination logic across platforms. It tackles the hard problems of paginated data (caching, request deduplication, page jumping) without rewriting code for each platform.

Key Takeaways

Critical Insight

Cash App's Multiplatform Paging lets you write pagination logic once and use it on both Android and iOS without learning a new API.

The library's approach to maintaining binary compatibility while going multiplatform is particularly clever.

About This Article

Problem

Pagination looks straightforward on the surface, but it involves tricky problems like in-memory caching, request deduplication, and page jumping that need complex solutions across multiple platforms.

Solution

Cash App wrapped AndroidX Paging for Kotlin and Multiplatform by creating two modules: paging-common for shared logic across platforms and paging-runtime for Android and iOS.

Impact

Multiplatform Paging maintains binary compatibility with AndroidX Paging on the JVM, so all dependent libraries keep working without any modifications or API changes.