Home / Insights / Architecture and Modernization

Architecture and Modernization

Migrating an iOS App from Objective-C and UIKit to Swift and SwiftUI: Incremental or Rewrite?

Many business iOS apps still run on Objective-C and UIKit code written years ago. They work, but every change takes longer than it should and hiring for the codebase gets harder. The question is rarely whether to modernise; it is how to do it without freezing the roadmap.

TopicsArchitecture and ModernizationMobile App Development

Key takeaways

  • Incremental migration is the default for apps in active use; a full rewrite needs a strong reason, such as an unworkable architecture or a product redesign.
  • Swift and Objective-C interoperate, and SwiftUI views can be hosted inside UIKit, so old and new code can coexist for a long time.
  • Start by adding tests and a clean module boundary, then migrate screens that are changing anyway.
  • Data and networking layers often deliver more value from modernisation than the UI layer.
  • Track progress with simple measures: share of code in Swift, screens on SwiftUI, crash rate and lead time for changes.

A typical modernisation request sounds like this: “Our iOS app was built several years ago, partly in Objective-C. It still works, but every feature takes longer, our developers dislike touching it, and we keep finding crashes in old screens. Should we rewrite it in SwiftUI?”

Sometimes the answer is yes. More often, the better answer is a planned, incremental migration that delivers improvements while the app keeps shipping features. This article explains how to decide, how to sequence the work and what to watch out for. If you are inheriting the app from another team, start with our checklist for taking over an inherited codebase before planning the migration.

Why modernise at all?

Modernisation should be justified by business outcomes, not by fashion. Good reasons include:

  • Slow delivery: simple changes take days because the code is tangled, untested or poorly understood.
  • Stability: crashes cluster in old code paths, often around memory management, threading or nil handling.
  • Platform features: widgets, newer Apple frameworks and recent UI patterns are far easier to adopt from Swift and SwiftUI.
  • Hiring and handover: fewer developers are comfortable maintaining large Objective-C codebases.
  • OS update cost: each annual iOS release breaks more of the old code, and deprecated APIs eventually need replacing.

If none of these apply, and the app changes rarely, a light-touch maintenance plan may be more sensible than a migration programme. Our article on software maintenance costs helps frame that comparison.

Incremental migration or full rewrite?

FactorFavours incremental migrationFavours a rewrite
App in active useYes; users and revenue depend on continuityLow usage or a planned relaunch
ArchitectureReasonably layered, even if datedBusiness logic embedded in view controllers throughout, no separation
Product directionSame core flows, gradual improvementsMajor redesign of flows and information architecture
Feature roadmapMust keep shipping during the workCan pause or run a slim roadmap for a period
KnowledgeBusiness rules are only documented in the codeRules are well understood and documented
Platform strategyStaying native iOSMoving to a shared codebase with Android

Rewrites carry a well-known risk: the old app holds years of edge cases and fixes that nobody remembers. The new app must rediscover them, often after users do. If you do choose a rewrite, run both apps’ behaviour against the same test scenarios and plan a staged rollout.

If the real driver is supporting Android at the same time, the decision changes completely; see native or cross-platform before committing to a Swift rewrite.

How old and new code coexist

Incremental migration works because Apple’s tools allow mixed codebases.

Objective-C and Swift

Swift and Objective-C can live in the same target. Swift code can call Objective-C through a bridging header, and Objective-C can call Swift classes exposed to it. This means you can write all new code in Swift and convert old files one at a time.

UIKit and SwiftUI

SwiftUI views can be embedded in a UIKit app using UIHostingController, a UIKit view controller that manages a SwiftUI view hierarchy and can be presented or embedded like any other view controller. In the other direction, UIKit views can be wrapped for use in SwiftUI. So a new settings screen can be built in SwiftUI and pushed onto an existing UIKit navigation stack.

Where coexistence gets awkward

  • Navigation that mixes UIKit and SwiftUI stacks needs a clear owner, or behaviour becomes inconsistent.
  • Shared state between old and new screens needs a common model layer, not duplicated state.
  • Theming and design tokens must be defined once and used by both, or the app looks inconsistent.
  • Some complex UIKit components (heavily customised collection views, text editing) may stay in UIKit for good reason.

A sensible order of work

  1. Assess: map modules, dependencies, crash hotspots, test coverage and deprecated APIs. Identify which screens change most often.
  2. Stabilise the build: update the toolchain, remove unused dependencies, move to Swift Package Manager where practical, and set up CI with automated builds.
  3. Add a safety net: write tests around critical flows (sign-in, payment, core transactions) before touching them. UI tests on these flows protect against regressions during migration.
  4. Modernise the foundations: networking, data persistence and models in Swift, with a clear boundary the UI can depend on. This often removes more crashes than UI work does.
  5. Migrate screens opportunistically: when a screen needs a feature change, rebuild it in SwiftUI. New screens are SwiftUI by default.
  6. Retire old code: delete Objective-C files and unused UIKit screens as they are replaced, so the codebase actually shrinks.

Agree a minimum iOS version early, because it determines which SwiftUI features you can use. Supporting older iOS versions may mean keeping more UIKit for longer.

Risks to manage

  • Behaviour drift: a rebuilt screen subtly changes validation, formatting or ordering. Capture current behaviour in tests or acceptance criteria before rebuilding.
  • Performance surprises: large lists and complex layouts behave differently in SwiftUI. Profile with Instruments on older supported devices.
  • Accessibility regressions: check VoiceOver, Dynamic Type and contrast on every migrated screen.
  • Half-finished migrations: without a plan to retire old code, you end up maintaining two patterns indefinitely. Track retirement as explicitly as new work.
  • Roadmap starvation: agree a split of capacity (for example, a fixed portion of each sprint) so migration neither stalls nor blocks features.

Measuring progress

Pick a handful of measures and review them monthly:

MeasureWhy it matters
Share of source files in SwiftSimple indicator of language migration progress
Screens on SwiftUI vs UIKitUI migration progress, weighted by screen importance
Crash-free sessionsStability should improve as old code is retired
Lead time for a typical changeThe real business outcome of modernisation
Automated test coverage of critical flowsConfidence to keep changing the app

Report these to stakeholders alongside feature delivery, so modernisation is seen as an investment with visible returns rather than invisible engineering work.

Frequently asked questions

Can we keep shipping features during the migration?

Yes, and for most apps you should. Incremental migration is designed for this: new features are built in Swift and SwiftUI while old code is converted alongside, with capacity agreed per sprint.

Should every UIKit screen eventually move to SwiftUI?

Not necessarily. Some complex or highly customised UIKit components work well and are costly to rebuild. Migrate where it helps delivery or quality, and leave stable, rarely changed screens until there is a reason to touch them.

How long does an iOS modernisation take?

It depends on the size of the codebase, test coverage, and how much capacity you allocate. A short assessment that maps modules, risks and a sequenced plan is the best way to produce a realistic estimate.

Do we need to raise our minimum iOS version?

Often it helps, because newer SwiftUI capabilities depend on newer iOS versions. Check your analytics for how many active users are on older versions before deciding.

Sources and methodology

Guidance reflects PoliteTech delivery experience. The external references below informed specific points in this article.

  1. Apple Developer Documentation: UIHostingController — Supported how SwiftUI views are embedded in a UIKit view hierarchy during incremental migration.

Is your iOS codebase slowing every release?

We can assess your app, map the risks and propose a migration sequence that keeps your roadmap moving.