Medium Alla Dubovska Jul 1, 2024

Challenges of mixed SwiftUI and UIKit codebases in iOS Apps

Article Summary

Medium's iOS team has been wrestling with a codebase dating back to 2013. Migrating from UIKit to SwiftUI? It's messier than you think.

Alla Dubovska from Medium's iOS team shares hard-won lessons from integrating SwiftUI into a legacy UIKit app. This isn't a theoretical discussion—it's a field report from the trenches of production code.

Key Takeaways

Critical Insight

Mixing SwiftUI and UIKit creates real technical debt through code duplication, debugging challenges, and navigation complexity that teams must weigh carefully.

The article reveals why Medium's PostPreview component became a particularly thorny migration challenge.

About This Article

Problem

Medium's iOS team had to deal with navigation system misalignment between SwiftUI's NavigationStack and NavigationSplitView versus UIKit's navigation controllers. This meant they needed extra data transformation work across their mixed codebase.

Solution

The team decided to use UIKit for app-wide navigation and keep SwiftUI's local navigation for specific feature flows. This hybrid approach reduced the architectural friction they were facing.

Impact

The team could adopt SwiftUI gradually without rewriting their entire architecture. They were able to modernize code from 2013 while keeping the app stable and keeping developers productive.