How Apple's new Swift coding language lives up to its name

Jun 06, 2014 by Dian Tjondronegoro
Developers will, according to Apple, be able to code faster and more efficiently than ever before, thanks to Swift. Credit: HackNY.org/Flickr, CC BY-NC

As Apple's Worldwide Developers Conference (WWDC) winds up in San Fransisco today, 1,000 Apple engineers and 5,000 developers will return to their parts of the world armed with Apple's own programming language.

In his keynote on Monday, Apple CEO Tim Cook unveiled – among other new developments – Swift and claimed it to be a significantly faster code for across iOS and OSX.

Apple is the latest tech firm to produce their own programming language (Google and Microsoft also have their own languages) and Swift can be used by Apple developers as of today with 677 pages of documentation available in the iBooks store.

But why would a company want their own programing language – especially when existing, general purpose codes such as Objective-C and C have been successfully used for 20 years?

So what's so good about Swift?

It pretty much comes down to speed.

While Apple (and other companies) supply the hardware, developers ultimately bring the most utility value out of technologies. The faster developers can code, the more apps can be created.

So let's have a look at why Swift is the next big thing (and why developers should take the time to learn a new language, as it were):

Swift is much easier to code with. Swift looks much "cleaner" than traditional codes. In addition to getting rid of nested brackets and semicolons (which makes code look very complex and harder to maintain), programmers can now use inferred types, which means that variables and constants can be declared without necessarily specifying the data type.

Developers can reduce debugging time over mundane and trivial errors (if you're interested in the nitty-gritty, Swift manages unsafe codes by self-managing memory, preventing overflows – in arrays, for example – and properly handling nil objects).

This video is not supported by your browser at this time.

It also means that new developers can be spared the need to learn Objective-C's complex and verbose syntaxes (but Swift will sit alongside existing Objective-C and C codes).

Swift is fast and powerful. Fast programming is a key ingredient in Apple's new hardware and software capabilities. Swift codes will be compiled using the same high-performance compiler, and it will be run natively to combine the best features from Objective-C and C.

Based on the presentation in WWDC, we saw statistics showing complex algorithms can be run much faster than Objective-C.

Swift supports "interactive playgrounds". "Interactive playgrounds" allow developers to immediately see the results of changing codes and keep track of progress timelines. This is particularly useful for debugging complex loops, algorithms and animations.

Speaking of new developments …

As widely expected, Apple joins Google and Microsoft's moves towards delivering health and home automation applications, as well as supporting stronger integration between native features (such as Siri and Notification View) and third-party apps and sensors.

The Health app joins Samsung's Gear Fit, Nike and Fitbit to bring health and fitness data, measured by mobile and wearable devices, into our palms.

A new tool for developers called HealthKit adds to the standard activity, heart rate and diet measurements by allowing developers to create third-party apps and sensors to measure factors such as blood pressure and sleep patterns.

Users can also create emergency cards with important health information such as allergies and blood types, accessible from the lock screen and emergency call screen.

Another development tool – HomeKit – will let us control aspects of our homes (such as lights and temperature) using our phones.

To enable natural interactions with our phone for home and health apps, iOS has evolved to allow Siri be hands free, similar to its Android counterpart Google Now.

We could say: "Hey Siri, I'm ready for bed", then the lights will automatically dim for sleep and the phone will go into "do not disturb" mode – perhaps even playing our favourite relaxing music.

With the introduction of Swift, we can expect to see more apps than ever – truly building upon Apple's 2007 slogan, "There's an app for everything".

Explore further: Bumper Apple package brings devices closer than ever

add to favorites email to friend print save as pdf

Related Stories

Apple expands into health, home with new software

Jun 03, 2014

Apple is expanding into home and health management as the company tries to turn its iPhones, iPads and Mac computers into an interchangeable network of devices that serve as a hub of people's increasingly ...

Hackathon team's GoogolPlex gives Siri extra powers

Apr 17, 2014

(Phys.org) —Four freshmen at the University of Pennsylvania have taken Apple's personal assistant Siri to behave as a graduate-level executive assistant which, when asked, is capable of adjusting the temperature ...

Recommended for you

Tablets, cars drive AT&T wireless gains—not phones

4 hours ago

AT&T says it gained 2 million wireless subscribers in the latest quarter, but most were from non-phone services such as tablets and Internet-connected cars. The company is facing pricing pressure from smaller rivals T-Mobile ...

Twitter looks to weave into more mobile apps

5 hours ago

Twitter on Wednesday set out to weave itself into mobile applications with a free "Fabric" platform to help developers build better programs and make more money.

Blink, point, solve an equation: Introducing PhotoMath

6 hours ago

"Ma, can I go now? My phone did my homework." PhotoMath, from the software development company MicroBlink, will make the student's phone do math homework. Just point the camera towards the mathematical expression, ...

Google unveils app for managing Gmail inboxes

6 hours ago

Google is introducing an application designed to make it easier for its Gmail users to find and manage important information that can often become buried in their inboxes.

User comments : 3

Adjust slider to filter visible comments by rank

Display comments: newest first

del2
not rated yet Jun 06, 2014
Apple will have to re-name HealthKit - that name is already in use (http://www.healthkit.com). Didn't they do a search before choosing the name?
supamark23
5 / 5 (1) Jun 06, 2014
Apple will have to re-name HealthKit - that name is already in use (http://www.healthkit.com). Didn't they do a search before choosing the name?


Nah, they'll just sue Healthkit claiming that Apple thought up the name first and bury them under legal paperwork until the give up. It's the Apple way, why innovate when you can just steal it.
alfie_null
not rated yet Jun 07, 2014
There's a certain amount of voodoo associated with a programming language's success. I can think of many that sounded nice when released, but never amounted to anything. In Apple's favor, their core of dedicated (and vocal) users. Not sure how many of them might care about programming languages, though.