Cash App Case Study: Getting the benefits of KMM without leaving their comfort zone
Alec Strong from Cash App shares their story of adopting KMM and benefiting from shared code across their mobile platforms.
Cash App is the easiest way to send money, spend money, save money, and buy cryptocurrency. We believe in providing everyone with access to important financial services so they can fully participate in the economy. The app launched in 2013 as a simple peer-to-peer payment app with 4 mobile engineers, and it now has 50 mobile engineers (split across iOS and Android) and 30 million monthly active users.
The decision to test out Kotlin Multiplatform started in open source. A library we maintain called SQLDelight was gearing up to generate Kotlin-only APIs, and the decision was made to also use KMM to make those generated APIs platform-agnostic. The fit seemed natural. Since SQLite is the most widely used cross-platform technology around, this would serve as an opportunity to test the technology, and it would open the doors for Cash App to use it later, since the Android version of the app relied heavily on the library at its core.
Visit the Kotlin Multiplatform Mobile portal to find more case studies from different companies!
In the last year, we’ve made major changes to how we use Kotlin Multiplatform to help teams to adopt it. We had originally introduced the Gradle toolchain to the iOS build by keeping the shared code in the same repository, but the added cost of running Gradle and rebuilding the project did not make sense in light of how often the dependency was being changed. Instead, we created a shared repository for Android/iOS to be the home for our shared business logic. Since then, our network, investing, and growth teams have all built features with parts of their business logic in KMM. What has made me most proud is that the contributions have come not only from Android and iOS team members, but from the server team as well! Since we use Kotlin for our server-side development, their team is now able to work in the repository, and because the platform-agnostic Kotlin so closely resembles Swift that the shift is manageable for our iOS team too.
In addition to using SQLDelight, we use CrashKiOS from TouchLab to get better stack traces in the wild, and we are in the process of adopting Wire to work with protocol buffers in the shared codebase. As for which parts of our business logic we’ve encouraged KMM as a solution for, we’ve had the most success so far with persistence and pure functions in the shared code, and next we’re hoping to work more closely with our network APIs using Wire.
Visit the KMM portal to create your first cross-platfrom application with Kotlin!
We love Kotlin Multiplatform because we didn’t have to give up any of the things we love about our work. We’re at a place now where the developer workflow is unchanged but there is an option to share code and get all of those benefits without stepping out of our comfort zone. Our teams are increasingly realizing the potential of KMM, giving it a shot, and seeing how powerful it is.
Senior Kotlin Developer