Objective-C to Swift: Migrating a Live iOS App
Moving an iOS app from Objective-C to Swift is done one class at a time, inside a single project where both languages live together, and you never have to stop shipping releases to do it. Apple’s own guidance recommends converting a file at a time, starting with a class that has no Objective-C subclasses, after first adding nullability annotations to the Objective-C code you plan to keep talking to. A well-run migration is a long series of small, reviewable changes that each leave the app working. The decisions that matter are which files to convert first and where to stop.

This guide is for the person who owns an existing app and has to decide whether the work is worth paying for, how to sequence it, and how to keep the app stable while it happens.
Should you move an Objective-C app to Swift at all?
You should move it only if the Objective-C code is costing you something you can name, because an Objective-C file that works and never changes isn’t a problem worth paying to solve. Objective-C code that was shipping last year compiles this year, and your users can’t tell which language a screen was written in. Converting for its own sake spends engineering hours that could go into fixes or features, and every conversion carries a small risk of introducing a bug into code that was behaving.
The reasons that do justify the work tend to be practical ones. New Apple frameworks such as SwiftUI are written for Swift, so an Objective-C app can’t adopt them directly without a Swift layer in between. Developers who learned iOS in the last several years are more likely to know Swift than Objective-C, which affects how quickly a new person can fix a bug in a file nobody has touched since the original author left. And some files are simply where the crashes live, in which case rewriting them in a language with stricter handling of missing values removes a whole category of runtime failures.
If none of those apply to your app, leave the code alone and write any new features in Swift. That alone gradually shifts the codebase without a migration project, and it keeps the option open for later. If you’ve inherited the app from a previous team and aren’t sure what you’re looking at, an app maintenance audit is the cheaper first step, since it tells you which files are worth the effort before anyone starts converting.
Do you have to rewrite the whole app at once?
You don’t have to, and trying to is the most common way these projects go wrong. Apple’s migration guide says you don’t need to rewrite your entire app in Swift at once, because Swift and Objective-C can coexist in the same project and call each other. You add Swift files next to the Objective-C ones, and each side can see the other’s classes once the right headers are in place.
That interoperability is what makes the work safe for a live product. Every converted class goes out in a normal release, behind the same review and testing you already run, and any single change can be reverted without touching the others. If the budget runs out or priorities shift after the first dozen classes, you still have a working app with a better foundation than you started with, and a half-finished rewrite would leave you with nothing you can ship.
Our article on rewrite versus refactor for mobile apps covers why the app stores make a big-bang rewrite so much riskier than it looks on a whiteboard. Converting to Swift class by class is a refactor in that sense, and it inherits the same advantage: you keep the same store listing, the same ratings and the same install base the whole way through.
Which classes should you convert first?
Start with a class that has no Objective-C subclasses and few dependants, because Apple notes that you can’t subclass a Swift class in Objective-C, so any class with Objective-C children has to wait until they’re converted first. In practice that means working from the leaves of your class hierarchy toward the trunk. Small model objects, value-like helpers, formatters, API response parsers and utility categories are the usual first candidates, since they have clear inputs and outputs and are easy to check.
After the first few easy wins, let evidence choose the order instead of taste. The files worth converting early are the ones that crash most often, the ones that change in almost every release, and the ones nobody dares to touch because nobody understands them. Your crash reporting shows the first group directly, and our comparison of Crashlytics and Sentry explains what each tool can tell you about a mixed-language codebase. Your version history shows the second, and the people who’ve worked on the app will name the third within a minute.
Decide too what to leave for last or leave alone permanently. Large view controllers that mix networking, layout and business logic are tempting targets, but converting them line by line carries all the old tangles into the new language. It’s usually better to pull the logic out into smaller classes first, convert those, and let the view controller shrink until its conversion is trivial.
Before any of this, make sure you have a safety net. A conversion that changes no behaviour is only provable if something checks the behaviour, so the classes you plan to move should have tests, or at least a manual script you trust. Our mobile app testing checklist is a reasonable starting point for the manual side, and a few unit tests written against the Objective-C version before the move turn the conversion into a before-and-after comparison.
How do the two languages see each other?
Each language reaches the other through a header file, and the setup depends on whether your code lives in an app target or a framework target. In an app target, Swift sees Objective-C through a bridging header. You list every Objective-C header you want Swift to see inside that file, and the Objective-C Bridging Header build setting under Swift Compiler - General has to point at it. Xcode offers to create the file the first time you add a Swift file to an Objective-C app, and names it after your product module with a bridging header ending.

Any public Objective-C header listed in the bridging header becomes visible to every Swift file in that target with no import statement, and you use the classes with ordinary Swift syntax. A common mistake on inherited apps is a bridging header that has grown to include every header in the project, which works but makes every Swift file depend on every Objective-C one. Trimming it to what Swift really uses makes later cleanup easier.
A framework target uses an umbrella header instead, and the Defines Module setting under Packaging must be set to Yes for the framework. Whatever you import in the umbrella header is what Swift in that framework can see.
Going the other direction is automatic. Xcode generates a header named after your product module with a -Swift.h ending, and you import it into any Objective-C file that needs to call Swift. By default it contains the Swift declarations marked public or open, and in an app target that has a bridging header it also includes the internal ones. Private and fileprivate declarations stay out of it unless you explicitly mark them with an Objective-C attribute. The name comes from the Product Module Name build setting, so a module name with unusual characters produces an unexpected generated header name, so check it first when an import won’t resolve.
Why should nullability annotations come first?
They come first because they decide what types Swift gives you for your old code, and Apple’s migration guide lists adding them as part of tidying up the Objective-C side before you start. Objective-C has no built-in way to say that a pointer can never be nil, so a property that’s always set and a property that’s often empty look identical to the compiler. When Swift imports unannotated declarations it can’t tell the difference either, so it treats them as implicitly unwrapped optionals, which compile without complaint and crash at runtime if the value turns out to be missing.

The fix is a mechanical edit. You wrap the declarations in a header between the NS_ASSUME_NONNULL_BEGIN and NS_ASSUME_NONNULL_END macros, which tells the compiler that everything inside is non-null unless marked otherwise, and then you mark the handful of genuinely optional properties and parameters as nullable. The annotated header now imports into Swift with honest types, where the always-present name is a plain string and the sometimes-missing nickname is an optional one.
Writing nullability down also forces someone to answer, for each property, whether nil is a legal value, and the answers often turn up latent bugs such as a method that has quietly been receiving nil for years. Do it for the headers of the classes that the first converted files will touch, and extend it outward as the migration reaches them. Annotating the entire project up front is a large task that tends to stall a migration before it starts.
How do you convert a single class safely?
You convert it in one small pull request that changes nothing about behaviour, following the same sequence each time. Apple’s guide describes the core of it, and a team that repeats the same steps makes fewer mistakes than one that improvises on every file.
- Create a Swift file for the class, and move the contents of both the header and the implementation into it.
- Make the class descend from an Objective-C class such as NSObject, so Objective-C code can still use it.
- Give it an Objective-C name if the existing name has a class prefix you want to keep.
- Import the generated Swift header in the Objective-C files that use the class.
- Remove the old implementation file from the target, and keep the originals around until the change has shipped.
Apple’s guide asks for the descent from an Objective-C class because that’s how a Swift class is made available to the Objective-C code that still depends on it. The Objective-C name matters when other files refer to the class by its old prefixed name, since keeping that name means those files don’t have to change in the same pull request.

If you leave the old implementation file in the target’s Compile Sources list, the build fails with a duplicate symbol error, because the class now exists twice. Apple’s guide says to deselect the file’s target membership before building, and not to delete the original files immediately, because comparing the old and new versions is the fastest way to find a behaviour difference. Once the change has been through a release and nothing has regressed, delete them.
A pull request that changes both language and logic makes any regression hard to attribute, so convert behaviour exactly as it was, including the awkward parts, and improve it in a second change.
What can’t cross the language boundary?
Anything that exists only in Swift can’t be seen from Objective-C, which shapes how you order the work. Swift structs, enums with associated values, tuples and generic types have no Objective-C equivalent, so a converted class that exposes them in its public methods can’t be called from the Objective-C files that still depend on it. You can keep those files compiling by designing the Swift class’s visible interface in terms of types both languages understand, such as classes, simple enums, strings, numbers and collections, until the Objective-C callers are gone.
The other rule that catches people is inheritance. Objective-C can’t subclass a Swift class, which is why you convert subclasses before parents, and why a class at the top of a deep hierarchy is the last thing to move rather than the first. If you find yourself wanting to convert a base class early, look for a way to restructure the hierarchy toward composition first, since that makes both languages’ lives easier.
There’s also a circular reference problem to know about. When an Objective-C header refers to a Swift class from the same target, importing the generated Swift header from inside that header creates a cycle. Apple’s documentation says to use a forward declaration of the Swift class or protocol in the Objective-C interface instead, and notes that forward declarations work only as types for method and property declarations. The import of the generated header then moves into the implementation file, where it’s safe.
What about automatic converters and third-party libraries?
Automatic converters are useful as a first draft, and their output needs review. Tools that translate Objective-C syntax into Swift, including the assistive tools Apple’s guide mentions, produce code that compiles more often than it reads well. The output frequently keeps Objective-C habits such as implicitly unwrapped optionals, manual type casts and delegate patterns that Swift has better tools for. Treat the result as a head start: read every line and run the class’s tests, because a converter doesn’t know which of your nil checks were load-bearing.
Leave third-party libraries alone in most cases. An Objective-C library works from Swift through the same bridging header, and swapping a dependency at the same time as swapping a language doubles the number of things that can have gone wrong when a bug appears. Replace a library when it’s unmaintained or blocking a store requirement, and on its own schedule rather than as part of the language migration.
If a dependency is what’s actually keeping the app from building against current tools, that’s a stabilization problem and should be handled first. Our app takeover and mobile app stabilization pages describe how we approach inherited apps in that state, because a migration on top of an app that doesn’t build cleanly will stall.
How long does it take, and when should you stop?
Nobody can give you a figure without looking at the code, because the cost depends on how many classes there are, how tangled their dependencies are, how much test coverage exists and how many Objective-C subclasses block the order of work. Be wary of any quote that offers a fixed price or timeline for converting an app nobody has examined. A short review of the repository, the crash data and the build setup is what turns a guess into an estimate, and it’s the first thing we’d do on your app at RapidLabs.
What you can plan for is the shape of the work. The early classes go quickly, the middle of the migration is a steady rhythm of conversions between regular releases, and the last stretch is the slowest, because what’s left is the large, entangled, rarely changed code that nobody wanted to touch in the first place. This is where stopping becomes a legitimate decision.
A reasonable stopping rule is that you keep converting while each file you convert either removes a source of crashes, unblocks a framework you want to adopt, or makes a file that changes often easier to work on. When the remaining Objective-C is stable, isolated and untouched for a year, leaving it in place costs almost nothing, and the mixed project keeps working indefinitely. For a sense of how ongoing upkeep and one-off projects compare in cost, see our breakdown of app maintenance cost.
What should you do first on your own app?
Start by finding out what you actually have, in this order: which parts of the app crash or change most, which classes have no Objective-C subclasses, and how much of the behaviour is covered by tests. That three-part picture tells you whether a migration is worth doing, where it should begin and how risky the first few changes are, and a short review is enough to produce it.
Then pick one small class from the leaves of the hierarchy, annotate its header with nullability, convert it in a single behaviour-preserving change, remove the old implementation from the target and ship it in an ordinary release. If that goes smoothly, you’ve proven the process on your own code at almost no risk, and you can decide with real numbers from your own team whether to continue. If it goes badly, you’ve learned that something underneath, such as the build setup or the test coverage, needs fixing first, and you’ve learned it cheaply.
Keep the app shipping and convert what pays for itself. Leave the remaining Objective-C where it sits for as long as it keeps behaving.
Frequently asked questions
Can an iOS app mix Objective-C and Swift in the same target?
Yes, and Apple documents it as a normal setup. An app target uses a bridging header to show Objective-C declarations to Swift, and Xcode generates a header named after your product module with a -Swift.h ending that shows Swift declarations to Objective-C. A framework target does the same job with an umbrella header and the Defines Module build setting set to Yes. Most live apps spend months or years in this mixed state while the migration runs alongside normal releases.
Which Objective-C class should you convert to Swift first?
Choose a class that has no Objective-C subclasses, because a Swift class can't be subclassed from Objective-C and Apple's own migration guide gives this as the first rule. Beyond that, a small model or helper class with clear inputs and outputs is a safer first move than a view controller that touches half the app. After one or two easy wins, move toward the files that crash or change most often, since that's where the conversion pays back its cost.
Do you have to add nullability annotations before migrating to Swift?
You don't have to, but Apple recommends it as the first tidy-up step. Without annotations, Swift imports every Objective-C pointer as an implicitly unwrapped optional, which compiles but hides which values can really be nil and moves crashes from build time to runtime. Wrapping a header in the NS_ASSUME_NONNULL_BEGIN and NS_ASSUME_NONNULL_END macros and marking the few nullable properties gives the Swift side honest types.
Why does Xcode report a duplicate symbol after converting a class?
The old Objective-C implementation file is usually still a member of the target, so the compiler sees the same class defined twice, once in the .m file and once in the new Swift file. Apple's migration guide says to remove the original .m file from the target before building, by clearing its target membership checkbox, and to keep the old files around for troubleshooting instead of deleting them straight away.
Should an old Objective-C app be rewritten in Swift?
Usually not as a single project, because a full rewrite stops improvements to the live app while the replacement is built, and the app stores give you no traffic layer to shift users gradually. Converting class by class keeps releases flowing and lets you stop at any point. The case for a full rewrite is narrower: the code can't build against the SDK versions the stores now require, or the foundation it rests on has been discontinued.
Stuck on a release, a crash, or an app nobody owns?
RapidLabs maintains, stabilizes and takes over existing iOS and Android apps. Send the app link, the stack, and what is going wrong, and you will get a plain answer on whether you need help at all.
Talk to a senior engineer about your app