+

Cookies on the Business Insider India website

Business Insider India has updated its Privacy and Cookie policy. We use cookies to ensure that we give you the better experience on our website. If you continue without changing your settings, we\'ll assume that you are happy to receive all cookies on the Business Insider India website. However, you can change your cookie setting at any time by clicking on our Cookie Policy at any time. You can also see our Privacy Policy.

Close
HomeQuizzoneWhatsappShare Flash Reads
 

Apple's Swift programming language is headed towards 'world domination' - here's why developers at Uber and Airbnb are placing their bets on it

Feb 9, 2020, 19:52 IST
Justin Sullivan/Getty ImagesApple CEO Tim Cook
  • Apple's Swift programming language launched in 2014, and quickly became a smash success with iOS developers.
  • Swift has already overtaken Objective-C, the previous programming language for iOS apps, in terms of usage. Uber, Airbnb, Square, 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 brand-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 actually an open source project, meaning developers can tinker with it and customize it to their hearts' content.
  • "In the last three to four years, most companies I've worked and interacted with do new feature developments in Swift," said Kaya Thomas, iOS engineer with meditation app Calm. "It's the future of iOS development. There's a huge investment in it not only from Apple but the iOS community."

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 on stage at Apple's Worldwide Developers Conference in 2017. It was a "modest goal," he continued, and that the plan had a 10- to 20-year timeline.

In some ways, however, Swift is already making significant progress towards that goal.

Advertisement

Apple released Swift to the world almost six years ago, in 2014, promising it as 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.

YouTube/ScreenshotChris Lattner, former Apple engineer, introduces Swift at the 2014 Apple WWDC

Apple says Swift is used heavily across its ecosystem of apps, including in foundational parts of its own 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: Not only do Swift programmers make a $120,000 annual salary on average, according to the Stack Overflow comprehensive developer survey, it's also the sixth-most loved programming language in the world.

Advertisement

"In the last three to four years, most companies I've worked and interacted with do new feature developments in Swift," said Kaya Thomas, iOS engineer with meditation app Calm. "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 that where Objective-C was starting to show its age, Swift is more modern, more concise, and comes with the full support of Apple and its resources. According to a report from 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, 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, before Apple officially launched it in 2014. The introduction of Swift was a big deal in the industry, says 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 says Swift feels like a "natural evolution" of Objective-C. Apple, for its part says 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.

Advertisement
Mike Windle/GettyAirbnb CEO Brian Chesky

"[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

A year later, in 2015, Apple made Swift available as open source, meaning 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 its 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.

Advertisement

But the other shoe never actually dropped: Swift fans say that they've been nothing but impressed with how Apple has updated and maintained Swift as an open source project, emboldening 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

Leah Culver, CTO and cofounder of Breaker, started experimenting with Swift upon its release. She says Swift brings together the best of more established languages like JavaScript, Python, Ruby, and even Objective-C - while leaving out many of the worst parts.

"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 co-founder and CTO Agis Tsaraboulidis says he encourages young developers to learn programming in Swift, which is actually the same way he did. It's less intimidating even than Objective-C, the previous standard in iOS development, he said.

Advertisement

"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 will warn developers about errors before the code actually 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, too. And for those developers who are updating older apps, or still learning the language, Swift can actually 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 where novice developers can learn to code and quickly design new apps with the language.

And last year, Swift hit a major milestone when Apple announced SwiftUI, a user interface framework that allows developers to design features for apps and how people interact with them.

Advertisement
AppleCraig Federighi, Apple's senior vice president of software engineering, announces SwiftUI at the 2019 WWDC.

"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 of 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, programming systems research scientist at Uber, builds performance tools for the ride-hail company to use internally, and uses Swift to improve how fast its code starts up and builds.

Barik says 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.

Advertisement

Uber decided to change its codebase because Swift is more reliable and can prevent crashes that were more common with Objective-C, Barik says. It also helps manage memory, so that a device doesn't run out of memory when using Uber.

AP Photo/Mark LennihanDara Khosrowshahi, CEO of Uber, speaks at the Bloomberg Global Business Forum, on Wednesday, Sept. 25, 2019 in New York.

"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 early 2016, not long after Swift was first released to 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.

Advertisement

"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.

Payments company Square is working to increase adoption of Swift internally. Square's head of mobile platform Sonali Sambhus says that 42% of Square's iOS codebase is now on Swift, with developers working to bring the older Objective-C code over to the newer language. All new code is written in Swift, Sambhus says.

Larry French/Getty ImagesJack Dorsey, CEO of Square and Twitter

"[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."

Advertisement

At Square, Sambhus says using Swift can even 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, in particular, caught on with so many developers so quickly.

As an open source language, it's 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, to match.

Another reason is that it capitalizes on Apple's loyal fanbase. 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.

Advertisement

"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," iOS developer Ish ShaBazz 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-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.

Advertisement

In the interim, Swift is starting to see serious usage outside of the iPhone and iPad. Developers have come up with ways to use it to power software for servers, and 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 to improve performance and memory usage on other kinds of devices.

Nelson, who created the Vapor project, predicts that the next step for Swift is to delve into the field of AI and machine learning, where Apple itself 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 says.

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."

NOW WATCH: The science behind how NFL quarterbacks throw perfect spirals

You are subscribed to notifications!
Looks like you've blocked notifications!
Next Article