How we build SwiftUI features in the Medium application
Article Summary
Medium's iOS team went all-in on SwiftUI for production features serving millions of users. Here's how they made it work in a legacy codebase.
Thomas Ricouard from Medium Engineering shares how the team (including engineers from the Glose acquisition) successfully integrated SwiftUI into Medium's iOS app that still contains Objective-C code. They built an entirely new architecture around Swift Packages, Combine, and modular design.
Key Takeaways
- Moved from monolithic architecture to Swift Packages for instant previews and faster builds
- Created LiveService and FakeService implementations using Combine publishers for clean testing
- Built UI features in isolated packages with action handlers for app communication
- Migrated Apollo GraphQL client from CocoaPods to Swift Package Manager
- Used protocol-backed fragments instead of concrete GraphQL types for flexible mocking
Medium proved SwiftUI works in legacy codebases by creating a modular package architecture that delivers faster iteration and instant previews without requiring a full rewrite.
About This Article
Medium's iOS app had a mix of old Objective-C code and newer Swift, so it wasn't clear if SwiftUI could work in production without rebuilding everything from scratch.
Thomas Ricouard's team built isolated Swift Packages using protocol-based abstractions and struct-based services. This let SwiftUI components develop separately from the main app, with Combine publishers handling the data flow.
Engineers could now preview SwiftUI changes instantly by compiling just the feature packages instead of the whole app. They no longer had to launch the full application to iterate on UI, which sped up the feedback loop between design and code.