- Apple’s Swift programming language launched in 2014 and quickly became a smash success with iOS developers.
- Uber, Airbnb, Square, the meditation app Calm, and some 500,000 other apps on the App Store are at least partially written in Swift.
- Developers say they love it because it’s fast, efficient, and easy to understand — with appeal for both established developers and novices new to the craft.
- Swift is also something of an aberration for Apple: While the company is well-known for its secrecy and love of proprietary standards, Swift is an open-source project, meaning developers can tinker with it and customize it to their hearts’ content.
- “It’s the future of iOS development. There’s a huge investment in it not only from Apple but the iOS community,” Kaya Thomas, an iOS engineer for the meditation app Calm, said.
- Visit Business Insider’s homepage for more stories.
Apple has always had big ambitions for Swift, the rapidly growing programming language it created for iPhone and iPad apps.
“My goal for Swift has always been, and still is, total world domination,” Chris Lattner, the creator of Swift, said onstage at Apple’s Worldwide Developers Conference in 2017. He said it was a “modest goal” and that the plan had a 10- to 20-year timeline.
In some ways, however, Swift is already making significant progress toward that goal.
Apple released Swift almost six years ago in 2014 and said it was a better, more intuitive way to build apps for iOS. Now Apple’s App Store has over 500,000 apps at least partially written in the language, including Uber, Lyft, Airbnb, and Square, and developers say most new iOS apps are created using Swift.
Apple says Swift is used heavily across its ecosystem of apps, including in foundational parts of its operating systems. The MacOS Dock, which is used to launch and switch between applications, is now written in Swift, for example.
Developers are also flocking to the language: Swift programmers make a $120,000 annual salary on average, according to the Stack Overflow comprehensive developer survey, and it’s the sixth most loved programming language.
“In the last three to four years, most companies I’ve worked and interacted with do new feature developments in Swift,” Kaya Thomas, an iOS engineer for the meditation app Calm, said. “It’s the future of iOS development. There’s a huge investment in it not only from Apple but the iOS community.”
Up until Swift’s release, iOS developers used the 36-year-old programming language Objective-C. Fans say Objective-C is starting to show its age and that Swift is more modern, more concise, and comes with the full support of Apple and its resources. According to a report from the analyst firm RedMonk in June, Swift has surpassed Objective-C in usage.
“When it was first released, it was no-brainer to use it as an alternative to Objective-C,” Tanner Nelson, the founder of the open-source Swift web framework Vapor. “That’s why there was a huge boom at the beginning. Everyone loves Swift because it was replacing Objective-C.”
The origins of Swift
A group of Apple developers, including Lattner, started working on Swift in 2010. The introduction of Swift was a big deal in the industry, according to Airbnb software engineer Francisco Diaz, and many indie developers and small companies quickly started playing with it.
Much of the iOS community had been longing for many of Swift’s core features, like reduced crashes and concise syntax, for years, and Diaz said Swift felt like a “natural evolution” of Objective-C. Apple, for its part, said it wanted to make people enjoy writing software more — Swift was built to be a clear, concise language that was both powerful and easy to understand.
“[Objective-C] was a language for another time with other priorities,” Diaz told Business Insider. “Swift has a modern look and feel and a big focus on safety.”
Opening up like never before
In 2015, Apple made Swift available as open source, which means it’s free for anyone to use, download, or modify. Opening it up like that paid off by attracting even more developers to the language who were now free to tinker and experiment with it to their hearts’ content.
It was still a big change from how Apple usually thinks about things, though. The iPhone maker is known for its secrecy and reliance on proprietary standards; making the entire Swift language open source felt too good to be true to some developers who wondered what the catch was.
But the other shoe never dropped: Swift fans say they’ve been nothing but impressed with how Apple has updated and maintained Swift as an open-source project, which has emboldened even more developers to jump in.
“I’ve always known Apple as a company that wants to control everything and own everything,” Vapor’s Nelson said. “Over the past four years, when they open sourced Swift, I’ve been continually surprised at how much they wanted to give Swift to the community … I’m not surprised about the idea because that is the only good way to grow a language and grow an ecosystem, and I just think it’s amazing they’re actually doing that.”
Why developers love Swift
“It tends to be the easiest and fastest way of making iOS applications,” Culver told Business Insider.
Indeed, developers say that Swift is easy to read and can build faster apps. Iris Health cofounder and Chief Technology Officer Agis Tsaraboulidis encourages young developers to learn programming in Swift, which is the same way he did. It’s less intimidating even than Objective-C, the previous standard in iOS development, he said.
“I think Swift is a more modern language than Objective-C,” Tsaraboulidis told Business Insider. “Many people don’t feel intimidated to use Swift than Objective-C because of how modern the syntax is and how easy it is to pick it up and start it.”
The technical details
In a more technical sense, Apple boasts that Swift is designed to eliminate the most common kinds of programming errors that can lead to security bugs. It’s memory-safe, which means it prevents unsafe behavior and vulnerabilities happening in code when it comes to accessing data. It warns developers about errors before the code compiles, making it easier for them to fix bugs before it’s too late.
Developers say that apps written in Swift tend to crash less often than those built in Objective-C. And for those developers who are updating older apps or still learning the language, Swift can be mix-and-matched with older Objective-C code.
Apple even has several tools to help developers get started with Swift. In 2016, Apple launched Swift Playgrounds, a platform written in Swift that teaches novice developers to code and quickly design new apps with the language.
And Swift hit a major milestone last year when Apple announced SwiftUI, a user-interface framework that allows developers to design features for apps and how people interact with them.
“It’s built in a very modular style and very modern,” Calm’s Thomas told Business Insider of SwiftUI. “A lot of people are excited about that, even Objective-C developers who haven’t learned Swift. This new UI framework will be the future.”
How Swift is used outside Apple
Popular apps like Airbnb, Lyft, and Uber depend on Swift to build their iOS apps. For example, Uber started migrating from Objective-C to Swift in 2015. Raj Barik, a programming-systems research scientist at Uber, builds performance tools for the ride-hailing company to use internally and uses Swift to improve how fast its code starts up and builds.
Barik said that in Uber’s iOS app, about 90% of the code is written in Swift, while the remaining 10% are libraries, or packages of code needed to support the app, written in Objective-C. Whenever engineers write any new code, it’s in Swift.
Uber decided to change its code base because Swift is more reliable and can prevent crashes that are more common with Objective-C, Barik said. It also helps manage memory so that a device doesn’t run out of memory when using Uber.
“We have been using Objective-C, but it was not reliable,” Barik told Business Insider. “It was not well-suited for the architecture. Because of which we moved to Swift. It was very attractive from a developer perspective.”
Likewise, Swift is the preferred language for iOS development at Airbnb. While the app still uses Objective-C, all new features are written in Swift. The decision was made in 2016, not long after Swift was first released as open source, because enthusiastic Airbnb developers had jumped headfirst into it. However, it’s worth noting that the Airbnb iOS app still uses Objective-C in some portions.
“We decided not to do a full migration but instead keep both languages and migrate slowly towards Swift without stopping feature development to rewrite existing Objective-C code,” Diaz said.
The payments company Square is working to increase the adoption of Swift internally. Sonali Sambhus, Square’s head of mobile platform, said 42% of Square’s iOS code base is now on Swift, and developers are working to bring the older Objective-C code over to the newer language. All new code is written in Swift, Sambhus said.
“[Swift] has documented benefits for performance,” Sambhus told Business Insider. “At Square, we take pride in being the leader for adopting the best as well.”
At Square, Sambhus said using Swift could improve developer retention and even employee morale because the code is faster and cleaner.
“We do try to hire the best in the industry, and the best will be learning the latest and greatest in the industry,” Sambhus said. “Us investing in Swift is great for hiring developers and developer retention.”
Why Swift became so popular
There are a few reasons why Swift caught on with so many developers so quickly.
As an open-source language, it has been able to attract a community of developers who can try it out, give feedback, and make their own contributions to the language. Similarly, Apple has released free tools that help developers get the most out of Swift, and that same community has released many of their own.
Another reason is that it capitalizes on Apple’s loyal fan base. To many developers, supporting Swift as open source is a positive sign that Apple, the company that controls the App Store on which they build their businesses, wants a friendly relationship.
“Hopefully because it’s open source and the engagement of the community, it continues to open Apple’s relationship and strengthen Apple’s relationship with the development community,” Thomas, the Calm engineer, said. “Apple has been a community that has long been closed off and private. It’s great they’re having more connections with the development community there.”
Finally, Swift’s relative ease means that it’s where new programmers are starting to learn the craft.
“I think one of the reasons is that Swift lowers the barrier of entry,” Ish ShaBazz, an iOS developer, told Business Insider. “As more people learn to be developers, they’re learning Swift and not Objective-C. As time goes on, the only folks in Objective-C are folks who have done it for a really long time. If anyone’s learned to develop in the last 4 to 5 years, they’re all learning Swift.”
The future of Swift
Even as Swift usage continues to grow, Apple has given no sign of dropping support for Objective-C. That’s not surprising: Older iOS apps continue to use Objective-C, and many seasoned developers are well-versed in both.
It’s not hard to imagine a not-so-distant future where that changes, though, and Apple begins slowly phasing it out. There’s some precedent; Google has slowly phased out Java as the standard for Android development in favor of Kotlin.
In the interim, Swift is starting to see serious usage outside the iPhone and iPad. Developers have come up with ways to use it to power software for servers, and it can even be used on hardware like the Raspberry Pi minicomputer. The same efficiency and ease that makes it so popular for iOS development also makes it desirable for improving performance and memory usage on other kinds of devices.
Nelson, who created the Vapor project, predicted that the next step for Swift would be to delve into the field of artificial intelligence and machine learning, where Apple is slowly establishing itself as a force to be reckoned with. Right now, machine learning is dominated by the Python language, but Swift is well-positioned to take over, he said.
Notably, Lattner, Swift’s creator, most recently worked at Google, where he worked on adding support for Swift in Google’s open-source artificial-intelligence project TensorFlow.
“They’ve been having huge success with that,” Nelson said. “We’re going to see Swift be a dominant language in machine learning and replacing Python for the same reason Swift is great on the server: You get nice syntax, and you’re not sacrificing performance.”