All articles

How to Convert app from Swift to Objective-C?

Logos of Objective-C and Swift

If you are reading this then you have an iOS app that was written in Swift.

However, for some reason, you are rethinking your decision to use Swift and want to use the tried-and-tested Objective-C instead.

You are therefore wondering how to convert your app from Swift to Objective-C.

In this case, you are in safe hands. In this article, I will explain how to do just that.


The Objective-C programming language: Explained
Swift: the disruptive language
What does Swift offer?
Swift: an expensive skill for entrepreneurs to hire!
Objective-C continues to hold ground
Swift and Objective-C learning resources
How to convert your project from Swift to Objective-C
Planning a large-scale Swift to Objective-C migration for your business?

The Objective-C programming language: Explained

Objective-C evolved from the groundbreaking C programming language. It is a general-purpose programming language that is suited to object-oriented programming. An important aspect of Objective-C is that it adds a messaging feature similar to that of Smalltalk. Read more about Objective-C in “Objective-C Tutorial”.

Brad Cox created Objective-C back in the late 1980s. Fundamentally, it is a set of extensions to C. While the number of extensions was actually quite small, they allowed for powerful object-oriented programming.

Steve Jobs, who built ’NeXT Software‘ after his initial tenure with Apple, developed a keen interest in this language.

Jobs later returned to Apple and initiated the developing OSX and iOS using Objective-C. Apple uses Cocoa programming extensively in their frameworks, and Cocoa programming uses Objective-C as its‘ mainstay. Read about the emergence of this language in “Learn Objective-C: a brief history”.

Swift: the disruptive language

A Swift logo

Apple unveiled Swift in 2014. Chris Lattner, a PhD. student at the University of Illinois was behind the creation of this powerful programming language. He had initially begun creating it as part of a research project and continued its development after he later joined Apple.

Apple provided the necessary resources to him to bring his project to life, and thus, Swift was born. Read more about the early history of the language in “Why learn Swift? The creation and evolution of a new programming language”.

Swift is a compiled, general-purpose language. The team behind Swift integrated the best practices of Objective-C, Ruby, Python, and C# when creating it. It is open-source and so developer-friendly. Apps for iOS, tvOS, macOS, and watchOS can use it. Importantly, Swift code can exist side-by-side with Objective-C, while Swift also works well with Apple’s Cocoa and Cocoa Touch frameworks.

There have been multiples releases of Swift. The latest stable release, Swift 4.2.1, was launched in October 2018. Read more about the language at the homepage.

What does Swift offer?

Swift offers quite a few advantages over rival languages. As a result, many developers want to convert their Objective-C apps to Swift. Our guide “How to migrate your Objective-C project to Swift?” which describes the process.

The advantages of Swift are as follows:

  • Apps coded with Swift are fast and high in performance.
  • The language reduces errors by design.
  • Swift has operators for several functions, therefore reduced the amount of coding required. The Codebase is smaller, too.
  • Its code follows English syntax, which improves the readability of the program.
  • Technology giants like IBM support it in addition to Apple, which bodes well for its‘ growth.
  • It‘s easier to maintain apps written in Swift.

Read “10 things I like about Swift” to learn more about these advantages.

Swift: an expensive skill for entrepreneurs to hire!

The advantages cited above have helped contribute to a significant rise in the popularity of Swift. It‘s quickly becoming the programming language of choice for many key Apple platforms. Read more about its‘ growing popularity in “Swift gains as iOS and macOS language, while Objective-C declines”.

What does the rising popularity of Swift mean for software entrepreneurs? If you have an iOS app built on Swift and plan to develop new features then the key is that you hire skilled Swift developers. That‘s not as easy as it sounds, however!

The demand for Swift developers is currently very high. Developers with this skill set can expect to earn a high salary. Read more about it in “Top 10 of programming languages with the highest salaries in 2017”.

You need to pay significantly higher rates if you hire Swift programmers. Naturally, this means that your costs go up. It can also mean that your hiring lead in time is longer due to this high demand. This can delay your project, so beware!

Nothing talks louder than your project cost and development time frame, therefore, it might be time to turn to Objective-C!

Objective-C continues to hold ground

The demand for Objective-C programmers has certainly reduced in recent times. However, the language continues to remain very important to the development community. Many developers continue to use Objective-C and indeed actually prefer it over Swift. There are various reasons for this:

  • Developers are already familiar with Objective-C, therefore, they find it easy to work with. On the contrary, some developers find some aspects Swift hard to acclimatize to.
  • Apple uses Swift with many iOS apps, however, they don‘t use it that frequently for other operating systems like macOS. Developers have interpreted this as a drawback to the language.
  • Some developers simply don‘t see enough incentives to convert everything to Swift.
  • Reports regarding slow compilation times of Swift code and duplication of runtime libraries have convinced some programmers to stick to Objective-C.
  • Some developers have pointed out problems in regards to the stability of new Swift releases.
  • Many developers have shared C++ code, therefore, they don‘t see advantages in migrating to Swift.

Read more about how developers continued support of Objective-C, in “Why many developers still prefer Objective-C to Swift”.

All this means that your plan to migrating your app from Swift to Objective-C certainly has many relevant reasons!

Swift and Objective-C learning resources

To migrate from Swift to Objective-C, you will need to hire developers with programming skills in both languages. This is now always easy. Consequently, it‘s important that you and your team know about the learning resources available to you.

Swift learning resources provides quite a few resources. These include instructions to download, a ’Getting started‘ guide and extensive documentation. You can view the source code on GitHub repositories, which are open-source. There are also guides for continuous integration, covering build management, automated testing, and deployment.

Apple developer portal features excellent learning resources for the language. This covers ’playgrounds‘, i.e., small programs where coders can immediately see the output of their code. It also features guidance on how to use the ’Read-Evaluate-Play-Loop‘ (REPL) shell with Xcode, i.e., Apples‘ ’Integrated Development Environment‘ (IDE). also has an online book called “The Swift programming language – Swift 4.2”. Finally, you can make use of the Swift language tutorial offered by

Objective-C learning resources

Objective-C is well established language. Many developers have worked with it over decades, therefore, hire good programmers should be a little easier. If you onboard developers with relatively less experience, however, they might need to use relevant learning resources. offers a comprehensive Objective-C training program. Access it here. Apple developer portal provides extensive information about the Objective-C runtime environment. This documentation includes classes, protocols, references, structures, and enumerations. You can access it here.

How to convert your project from Swift to Objective-C

A screenshot comparing Objective-C and Swift code

How to Convert app from Swift to Objective-C: Steps

  1. Establish expectations
  2. Onboard your experienced development team
  3. Get all the right tools
  4. Outline code for Swift to Objective-C conversion
  5. Identify Objective-C equivalent of Swift code
  6. Convert and test code
  7. Deploy your code

Step #1: Stakeholder expectation management

You need to manually move your app from Swift to Objective-C. There is a limited import function. You can import Swift types and declarations into your Objective-C code. Read “Importing Swift into Objective-C” to know more about it.

However, there is no tool to enable automatic Swift to Objective-C conversion. The reason could be the lack of demand for such code porting tools, moreover, some features of Swift have no equivalent in Objective-C. Examples of such features are generics, algebraic data types, and pattern matching. Read more about this in this Stack Overflow Q&A thread.

To convert Swift to Objective-C, you need a custom development project since you have to manually convert the code. You need to adequately explain this to your business stakeholders, which will help in setting the right expectations about the project schedule and budget.

Step #2: Induct a team to migrate your app from Swift to Objective-C

Assuming that you aren‘t adding any new features and that you already have a ’Mobile Backend as a Service‘ (MBaaS) account, you can proceed. Based on these assumptions, you can exclude business analysts, ’user interface‘ (UI) designers, mobile backend developers, and cloud infrastructure developers/architects from the team.

You need to hire iOS developers with Swift and Objective-C skills. You need testers, and finally a project manager (PM). Since mobile app development projects follow iterative (stint) development, I recommend you use the Agile methodology. Consult our guide “How to build an Agile development team?”.

Step #3: Use the right tools for migrating apps from Swift to Objective-C

You need a robust ’integrated development environment‘ (IDE) when converting your app from Swift to Objective-C. JetBrains offers one such IDE for Objective-C developers. It‘s called “AppCode”, and it facilitates iOS/macOS development.

This IDE takes care of several routine tasks and saves typing effort. AppCode is easy to navigate, moreover, it offers code completion features. There is also a code refactoring feature, which helps with better coding.

AppCode continuously monitors your code and alerts you about errors. It also suggests remedies. This IDE supports testing frameworks like XCTest, Boost.Test, etc., which makes unit testing easier for you. You can access their detailed documentation here, furthermore, you can find its‘ price here.

Step #4: Identify code for Swift to Objective-C conversion

You don‘t need to convert your entire Swift app into Objective-C. Pieces of codes written in Swift can coexist with Objective-C code in the same project. There are several instances where developers use both languages in one app. Read more about it in “Mix and match: Objective-C and Swift”. I recommend that you identify what you want to convert, keeping in mind your project schedule and budget.

Step #5: Study Objective-C equivalent of Swift code

Migrating apps from Swift to Objective-C is a manual process, however, the good news is that there is help at hand! Read “Objective-C to Swift conversion cheat sheet”. This is an excellent source of information, where you can study Objective-C equivalent of Swift code.

This cheat sheet covers significant ground. You can find the following help in the sheet:

  • How programmers can create a variable in Objective-C vs Swift?
  • In which way the creation a constant in Objective-C varies vis-à-vis Swift?
  • What is the difference between creating a variable array in Objective-C vis-à-vis Swift?
  • How can developers create a constant array in these two languages?
  • What do developers do differently in Objective-C when they add a value-type to an array, from what they need to do in Swift?
  • How is creating a dictionary different in Objective-C from that in Swift?
  • What should programmers do to define an ’enum‘ in Objective-C, vs what do they do in Swift?
  • How do developers append a string in Objective-C, and how is it different from Swift?
  • Adding to a number: what‘s different in Objective-C vs Swift?
  • How does string interpolation vary between Objective-C and Swift?
  • Debugging information is important. How differently do developers print it in Objective-C, from what they do in Swift?
  • What changes in Objective-C from Swift when checking a condition?
  • How to implement looping a predetermined number of times in Objective-C, vs how it‘s done differently in Swift?
  • What is the difference in Objective-C vs Swift when looping over an array?
  • How Objective-C treats the function of switching over a value, vis-à-vis how Shift treats it?
  • What are the differences between functions in Objective-C from those in Swift?
  • How creating different kinds of ’classes’ vary from Swift to Objective-C?

This is not an exhaustive list and the cheat sheet covers more.

Step #6: Convert your code and test it

The next step is to convert your code. I recommend you do it in iterations. You need to test your code to ensure it works. XCTest is a good option. I recommend you read “Real-World Testing with XCTest”. It‘s a useful source of information where you will find guidance about several key testing aspects.

For e.g., the article shows how to avoid ineffective testing practices. There are insights about using XCTest. You will discover the best practices for naming your test artifacts. In most tests, you need to use mocking frameworks. This helps since a “mock” returns a predefined answer to a method call. OCMock is a good mocking framework.

Step #7: Deploy your converted and tested code

Thankfully, since you are using AppCode, you will find it easy to deploy your code. Visit the JetBrains AppCode “Build, Execution, Deployment” webpage for instructions. Find detailed instructions specifically for deployment here.

Planning a large-scale Swift to Objective-C migration for your business?

If you have a complex set of apps to migrate from Swift to Objective-C, the project can be a time consuming one. Namely, there’s no automatic swift to Objective-C converter.

Such projects require the timely hiring of skilled developers, moreover, you will need end-to-end project management. Consider engaging a software development company. Consult our guide “How to find the best software development company?” to learn more.