‘Fast, modern, safe, and a joy to write’: Why Apple is banging the drum on Swift as a successor to C++

Male software developer coding in Swift programming language on a Macbook while sitting in an open plan office space.
(Image credit: Getty Images)

Swift is the best programming language to replace C++, according to a senior figure at Apple, as scrutiny over software safety continues to rise. 

Ted Kremenek, Apple director of languages and runtimes, made the claim at Apple’s World Wide Developer Conference (WWDC) earlier this month while announcing a raft of updates for the programming language.

Introduced by Apple in 2014, Swift was originally intended to act as a successor to Objective-C. However, the popularity of the programming language has boomed in recent years, and over one million applications are now using Swift.

Kremenek noted that the language has now become crucial for Apple, and the company has been keen to promote it as a safer alternative to C++.

“It’s fast, modern, and safe, and a joy to write,” he said.

“We created swift to be an expressive and safer programming language that would simplify the process of writing software,” Kremenek added. Swift is an ideal language for app development, and is used by almost one million apps.”

Swift is great for “more than just apps”, however. Kremenek said Apple now uses Swift throughout its software stack, “from apps and system services to frameworks all the way down to firmware, like Secure Enclave”.

The programming language is also used in network services like Apple’s Private Cloud Compute (PCC).

“Combined with built-in C and C++ interoperability means Swift is the best choice to succeed C++.”

Why Apple is championing the shift to Swift

Prior to the advent of Swift, software on Apple devices was primarily written using C, C++, and Objective-C, Kremenek noted. In recent years, however, there’s been a degree of pushback against languages such as C and C++, specifically due to security concerns. 

In November 2022, the US National Security Agency (NSA) recommended only using ‘memory safe’ languages like Rust, Swift, or Java to avoid exploitable memory-based vulnerabilities.

This initial call to arms has since gathered pace amid rising concerns over software vulnerabilities across the last 18 months. In February this year, the White House once again urged developers to ramp up efforts to switch to memory safe languages.

RELATED WHITEPAPER

The warning followed the publication of a report by the White House Office of the National Cyber Director (ONCD), which found that developers can prevent entire classes of software vulnerabilities by adopting safer options.

The White House has a vested interest in banging the drum for memory safe languages given the critical importance of software and hardware manufacturers in bolstering national cyber resilience.

Like lawmakers, Apple’s contention here is that moving to Swift will improve the quality of software not only at the company but throughout the industry.

Apple is committed to Swift

Apple has made no secret of its transition to Swift in recent years, and during his keynote at WWDC Kremenek teased plans for the programming language. 

Chief among these are plans to launch a new GitHub organization dedicated to Swift, github.com/swiftlang. This will host “a number of critical projects” for the Swift ecosystem, including the Swift compiler, foundation, and other “key libraries”.

Kremenek also made reference to the launch of Swift 6, which is expected to arrive later this year. Swift 6 will make concurrent programming “dramatically easier” by introducing “data race safety”, he said.

A data race occurs when different parts of code try to modify and access the same data simultaneously, Kremenek explained. With Swift 6, however, these kinds of bugs will be eliminated by diagnosing them at compile time.

Ross Kelly
News and Analysis Editor

Ross Kelly is ITPro's News & Analysis Editor, responsible for leading the brand's news output and in-depth reporting on the latest stories from across the business technology landscape. Ross was previously a Staff Writer, during which time he developed a keen interest in cyber security, business leadership, and emerging technologies.

He graduated from Edinburgh Napier University in 2016 with a BA (Hons) in Journalism, and joined ITPro in 2022 after four years working in technology conference research.

For news pitches, you can contact Ross at ross.kelly@futurenet.com, or on Twitter and LinkedIn.