Embracing SwiftUI: PhonePe's Journey Building ONDC-Powered Pincode
Article Summary
PhonePe's iOS team built their entire ONDC shopping app in SwiftUI when most considered it too risky for production. The result? 1M+ downloads and a blueprint for modern iOS development.
The Pincode iOS Team shares their journey building PhonePe's standalone shopping app using SwiftUI instead of UIKit. Launched in April 2023, this was a bold bet on Apple's declarative framework for a greenfield e-commerce product connecting users to local stores via India's ONDC network.
Key Takeaways
- Built custom navigation solution combining UIHostingViewController and UINavigationController to fix SwiftUI bugs
- MVVM with Combine proved superior to MV pattern for maintainability at scale
- Avoided nested LazyVStacks after discovering unexpected layout and performance issues
- Achieved 1M+ downloads across platforms within months of April 2023 launch
PhonePe proved SwiftUI is production-ready by shipping a complete e-commerce app that hit 1M+ downloads, establishing a path for adopting it in their main 1.2M line codebase.
About This Article
PhonePe's crash reporting tool couldn't properly symbolicate crashes from SwiftUI, Combine, and Metal Performance Shaders Graph because Apple doesn't provide debug symbols for these frameworks. The team had no way to analyze production issues effectively.
The Pincode iOS Team built custom modifiers and created a declarative Design System based on SwiftUI's approach. They moved away from their original ViewModel-based design system to cut down on boilerplate code and keep components consistent.
PhonePe was able to bring developers over from UIKit to SwiftUI's declarative model. The team gained confidence that SwiftUI was ready for production use, and they now have a template for rolling out SwiftUI across their 1.2M line-of-code codebase.