Is Objective-C Still Relevant in 2022 or Is Swift the Only Real Choice?
Senior iOS Developer
Content Marketer & Technical Expert
It’s probably easy to say that whatever end goal you would want to achieve with Objective-C you can achieve it with as well with Swift. There’s a good chance going with Swift would yield quicker results. Sure, developers may deliver apps or libraries regardless of whether the chosen language is Swift or Objective-C. After giving it some thought, however, we can’t come up with an edge case that would make the decision leaning toward using Objective-C for iOS mobile application development.
Disclaimer: we’re assuming you are a company that doesn’t only hire developers with Objective-C knowledge at their disposal.
We know our initial thoughts are rather harsh towards Objective-C. We’d like to point out that our developers mostly loved programming in Objective-C and still love it for its power to deliver products. Furthermore, Objective-C is a piece of art, creators packed genius solutions and were constantly improving it, so us developers were able to use it at our advantage.
There are a lot of indicators telling us there’s still a ton of legacy Objective-C code, both from Apple and from other developers, that’s still in use. Looking at some statistics from the StackOverflow 2021 survey, we see that 5.1% of respondents use Swift, whereas 2.8% use Objective-C, making it an approximate 2:1 ratio. Don’t get us wrong, probably if you look hard enough, you’ll still find demand for Objective-C development (probably maintenance is a more suited word here).
Let’s look at some numbers.
Number of Developers
When looking at number of developers skilled either in Swift or Objective-C (or both), we managed to find some statistics from JetBrains (2021) showing that out of all developers participating in their survey, 76% of developers are skilled in Swift, 13% are skilled both in Swift and Objective-C, whereas 11% are only skilled in Objective-C. The statistics are pretty self-explanatory.
What we’d like to point out at this point is that we should not be blindly looking at numbers, but instead try to understand where those numbers come from. The creators of the PYPL Popularity Index say, “The more a language tutorial is searched, the more popular the language is assumed to be. It is a leading indicator.
The raw data comes from Google Trends. This index is created by analyzing how often language tutorials are searched on Google. But instead of “Objective-C tutorials” a phrase “iOS tutorials” is used. Nowadays, we could say for some historical reasons. But the key takeaway here is that anyone searching for “iOS tutorials” will probably land on a tutorial based on Swift.
It’s easy to see how such numbers can be very misleading and give a wrong impression of equal popularity among Swift and Objective-C for native iOS app development.
Importing Frameworks From Other Languages – Swift Has You Covered
There’s one task that just recently would still require Objective-C to be used alongside Swift in a project to develop a native mobile app. Till recently, if you wanted to use an e.g. Rust or C++ library in a Swift project, you were required to use Objective-C with bridging headers to act as intermediate language that would serve as connection from Swift to your chosen framework in the other language.
According to Thomas Karpiniec now with Xcode 13 and Swift 5.6 you don’t need Objective-C anymore. When libraries are correctly set up, you can import and link them in your Swift project and use them with just Swift.
iOS, iPadOS, macOS watchOS, tvOS, Ubuntu, CentOS, Amazon Linux, Windows
Cross-platform (but rarely seen on non-Apple platforms)
Is It Actively Developed?
Did we mention, there are Swift exclusive features?
This category of comparison might be most biased or just based on opinion, but the only technology coming to our minds that’s based exclusively on Objective-C is perhaps if you wanted to use a slightly modified version of an Objective-C framework. As we know, today, it’s easy to import an Objective-C framework in a Swift project. Perhaps, however, you would need that Objective-C framework to behave slightly different, in such a way, so that it would make sense to just modify the framework and then import it in Swift, rather than making workarounds in Swift to achieve the same goal.
It's the one, and only, thing that would count as an exclusive for Objective-C.
On the other hand, there are many language features that you can take advantage of only by using Swift. Let’s list a few: SPM, SwiftUI, WidgetKit, Combine, async/await, property wrappers, enums with associated values… In today’s terms those represent the state-of-the-art for modern iOS development, which btw. has most developers engaged with regarding developers developing on Apple products (macOS, iPadOS, tvOS, watchOS).
SPM - The Swift Package Manager
Per swift.org, “The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.”
SPM is included in Swift 3.0 and above. Although it was released with some shortcomings (e.g. dealing with binary frameworks) by now it’s vastly improved. We can say that it’s a standard for dependency management with Swift projects, now. Helping in that is the fact that developers who maintain open-source repositories in great extent added the ability to import their framework with SPM.
Carthage and CocoaPods
As for the other dependency management tools, namely Carthage and CocoaPods, we can be short and say that both allow equal workflows for both iOS and Objective-C based projects. So those tools don’t make a difference in consideration to a programming language.
360° IT Check is a weekly publication where we bring you the latest and greatest in the world of tech. We cover topics like emerging technologies & frameworks, news about innovative startups, and other topics which affect the world of tech directly or indirectly.