Book a free call

How to Convert an Objective-C App to Swift

Converting an Objective-C app to Swift means rewriting it module by module while the app keeps shipping. Here is the plan, the bridging setup and mistakes to avoid.

Hertiv engineering teamReviewed by a senior engineer
7 min read
How to Convert an Objective-C App to Swift
On this page

Short answer

Converting an Objective-C app to Swift means rewriting its code in Apple's Swift language, usually one module at a time, while the app keeps shipping. Swift is the modern language for iOS apps, and a gradual migration lets a team move code over without stopping releases or rewriting the whole app at once.

What does converting an Objective-C app to Swift mean?

Converting an Objective-C app to Swift means rewriting the app's code in Swift, Apple's modern language for iOS, macOS and watchOS apps. Objective-C was the original language for iOS apps, and many older apps still run on it, but new development and most learning material now use Swift.

A conversion is rarely a single rewrite. Most teams migrate module by module: one screen, one feature or one library at a time, while the rest of the app stays in Objective-C. The two languages can live in the same app, which is what makes a gradual move possible.

The work is more than translating syntax. Swift has different rules for memory, optionals and error handling, so a conversion is also a chance to fix old patterns, such as unchecked nil values and sprawling view controllers. It is a migration project, not a search-and-replace job.

Whether it is worth doing depends on the app's future. An app that will be maintained for years benefits from Swift; an app in maintenance mode with few changes may not. How Swift is shaping the future of iOS development explains where the language is heading.

When is it worth converting?

It is worth converting when the app has years of active development ahead, the team hires Swift developers, and the Objective-C code is slowing new features down. It is not worth it for an app that is barely changing, or when the only reason is fashion.

SituationConvert nowLeave it
Active development, new features plannedYes, module by moduleNo
Team hires Swift developersYes, hiring gets easierNo
Objective-C code blocks new featuresYes, start with that moduleNo
App in maintenance modeNoYes, fix bugs only
Retirement planned within a yearNoYes, do not spend the budget
Only a few screens left in Objective-CYes, finish the jobNo

The decision is a business one, not a technical one. A conversion costs engineering time that could go to features, so it needs a reason tied to hiring, maintenance or the app's future. If the app is stable and the team knows Objective-C well, staying put is a valid choice.

How do you plan the migration?

You plan the migration by mapping the app's modules, ranking them by value and risk, and converting the easiest valuable module first so the team learns the pattern before touching the risky code.

Start with an audit: list the modules, count the lines in each, and note the dependencies between them. Modules with few dependencies and good test coverage go first. Core modules, such as networking, payments and data storage, go last, because a mistake there affects the whole app.

Agree the rules before writing code: which Swift version and style guide to use, how optionals are handled, and how the team reviews mixed-language code. A short written plan, shared with the whole team, prevents each developer from inventing their own approach.

Set a pace the team can sustain alongside feature work, such as one module per release. A migration that stops all feature work for months will be cancelled; one that moves steadily alongside releases will finish. Why Swift fits enterprise iOS development covers the hiring and maintenance case.

How does mixed Objective-C and Swift code work?

Mixed Objective-C and Swift code works through a bridging header: a single header file that lists the Objective-C headers Swift is allowed to see, so Swift code can call Objective-C classes and the other way round.

Xcode generates the bridge in both directions. Swift code sees Objective-C classes through the bridging header, and Objective-C code sees Swift classes through a generated header that Xcode creates automatically. The app builds as one target, with both languages compiled together.

Not every Objective-C pattern translates cleanly. Swift sees Objective-C types as optionals where the original code did not promise a value, so the conversion forces the team to decide, for each value, whether it can be missing. That is tedious, but it is also where many old crashes get fixed.

Keep the bridge small. A bridging header that exposes everything becomes a maintenance burden, so expose only what the Swift code actually needs, and remove entries as modules are converted.

How do you convert the code, module by module?

You convert a module by writing its Swift replacement alongside the Objective-C original, switching the app to the new code behind a flag, and deleting the old code only after the new code has shipped and proved itself.

  1. Pick one module. Choose a small module with few dependencies and good test coverage, such as a settings screen or a utility library.
  2. Write the Swift version. Rewrite the module in Swift, following the team's style guide, and keep the public interface the same so callers do not change.
  3. Wire it through the bridge. Expose the Swift code to Objective-C through the generated header, or call Objective-C from Swift through the bridging header.
  4. Run the existing tests. The module's tests should pass unchanged; if they do not, the conversion changed behaviour and needs a second look.
  5. Ship behind a flag. Release the new code to a small share of users first, and watch crash reports and key flows before widening the rollout.
  6. Delete the old code. Once the Swift version has run cleanly in production, remove the Objective-C files and the bridge entries they needed.

Repeat the cycle for the next module. The app stays shippable at every step, which is the whole point of converting gradually instead of rewriting everything at once.

How do you test and roll out the converted app?

You test a converted app the same way you test any change: the existing tests must pass, the converted screens must be exercised by hand, and the rollout must be staged so a problem reaches a few users before it reaches all of them.

Automated tests are the safety net. If the module has unit tests, run them against the Swift version before shipping. If it has no tests, write a few for the riskiest paths first, because converting untested code is how regressions slip through.

Manual testing matters too, because a conversion can change behaviour that tests do not cover, such as layout, animation timing or error messages. Walk through the converted screens on a real device, not only in the simulator.

Roll out in stages: internal testers first, then a small share of users, then everyone, watching crash reports and the metrics that matter for that module. Mobile app development covers the wider release process.

Example (hypothetical): a team converts a 60,000-line app

Example (hypothetical): a team maintains a shopping app with 60,000 lines of Objective-C, split into 12 modules. It decides to convert one module per release, with a release every two weeks, and estimates each module takes about one developer-week to convert and test.

The first module is the settings screen, 3,000 lines. It takes one week to convert and ships cleanly. The second is the search module, 6,000 lines, which takes two weeks because it touches the network layer. After 6 releases, 6 modules and 18,000 lines are converted, which is 30% of the app.

At that pace the team expects the full conversion to take about 20 weeks of developer time spread over a year, alongside feature work. The app ships every two weeks throughout, and no release is blocked by the migration. The lesson is that steady, small steps finish the job without stopping the product.

What are the common mistakes?

The most common conversion mistakes are rewriting everything at once, converting the riskiest module first, and deleting the old code before the new code has proved itself in production.

  • Big-bang rewrite. Rewriting the whole app at once stops feature work for months and usually gets cancelled; convert module by module instead.
  • Riskiest module first. Starting with payments or the data layer means the first conversion is also the most dangerous; start with a small, well-tested module.
  • Deleting old code too early. Remove the Objective-C files only after the Swift version has run cleanly in production for a full release cycle.
  • Ignoring optionals. Forcing every optional value open to make the code compile brings back the crashes Swift was meant to prevent.
  • No tests before converting. Converting untested code means nobody can tell whether the new version behaves the same as the old one.
  • Skipping the style guide. Without agreed rules, each developer writes Swift in a different style and the codebase becomes harder to read than before.

Key takeaways

  • Swift is the modern iOS language; Objective-C apps can migrate one module at a time
  • A bridging header lets Swift and Objective-C code call each other in the same app
  • Convert the easiest well-tested module first and the risky core modules last
  • Ship each converted module behind a flag and delete the old code only after it proves itself
  • A big-bang rewrite usually fails; steady module-by-module work finishes the job

Frequently asked questions

Can Swift and Objective-C live in the same app?

Yes. A bridging header exposes Objective-C code to Swift, and Xcode generates a header that exposes Swift code to Objective-C. The two languages compile together in one target, which is what makes a gradual, module-by-module migration possible.

How long does it take to convert an app to Swift?

It depends on the size of the app and how much feature work continues alongside it. A small app may take a few weeks, while a large app converted one module per release can take a year or more. The steady pace matters more than the total time.

Do I need to rewrite the whole app at once?

No, and you should not. The usual approach is to convert one module at a time, ship each converted module, and delete the old code only after the new code has run cleanly in production. The app stays shippable throughout.

What is a bridging header?

It is a single header file that lists the Objective-C headers your Swift code is allowed to see. Xcode uses it to make Objective-C classes available in Swift, and it generates a matching header in the other direction so Objective-C can call Swift code.

Will converting to Swift make the app faster?

Sometimes, but speed is not the main reason to convert. The main gains are easier hiring, better tooling, safer handling of missing values, and a codebase that matches current learning material. Measure performance before and after if speed is the goal.

What happens to my Objective-C tests during conversion?

They should keep passing. A good conversion keeps the module's public interface the same, so existing tests run unchanged against the Swift version. If tests fail, the conversion changed behaviour and needs a second look before shipping.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: software products in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Converting an Objective-C app to Swift and want the migration planned properly? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Mobile App Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call