How Duolingo used Macros to Promote MVVM architecture adoption
Original post How we used Macros to Promote MVVM architecture adoption
Article Summary
Carter Levin from Duolingo just eliminated 4,300 lines of boilerplate code that never needed to be written, reviewed, or tested. Here's how Swift Macros made their MVVM architecture adoption actually enjoyable for developers.
As Duolingo's iOS team scaled rapidly, their Client Architecture team faced pushback on new MVVM guidelines due to excessive boilerplate. Rather than compromise on architecture quality, they turned to Swift Macros to auto-generate repetitive DataSource implementations at compile time.
Key Takeaways
- Generated 4,300+ lines of standardized code across their iOS codebase
- Reduced clean build time impact by manually linking binaries instead of SPM
- DataSource layer proved ideal: consistent patterns but difficult to abstract with generics
- Macros operate on AST, not text, making them more reliable than scripts or AI
Duolingo automated away thousands of lines of error-prone boilerplate while maintaining architecture standards, proving that Swift Macros can solve the adoption friction that kills good architectural decisions.
Continue reading
This page summarizes “How we used Macros to Promote MVVM architecture adoption” by Duolingo, published Jul 10, 2025. All credit for the original work goes to the authors.