Apple launches Swift, a new programming language for writing iOS and OS X apps

Apple has surprised developers by launching a new programming language called Swift during the WWDC Developer Event. This new language seems to be poised to replace Objective-C as the main programming language on Apple’s platforms.

According to TechCrunch Blog, Swift will use the same LLVM compiler and runtime as Apple’s Objective-C implementation, so Swift and Objective-C code can live side-by-side in the same application. The language provides access to all of the Cocoa and Cocoa Touch features developers are currently used to from Objective-C.

It should feel familiar to those who are already used to Objective-C, Apple says, and is meant to “unify the procedural and object-oriented portions of the language.” It does diverge from Objective-C in more than just the syntax, though; it also features variable types like tuples and optional types. It also includes operators that aren’t found in Objective-C, which allow you to perform remainder operations on floating-point numbers, for example.

Here are some of the highlights of the language according to Apple: closures (similar to blocks in C and Objective-C) unified with function pointer, tuples and multiple return values, generics, fast and concise iteration over a range or collection, structs that support methods, extensions, protocols and functional programming patterns, e.g.: map and filter

In addition, Apple notes how the language was designed for safety, with variables that have to be initialized before use, arrays and integers that are checked for overflow and automatic memory management.

Swift support, of course, will be deeply integrated into Apple’s updated Xcode IDE. It will feature an interactive “Playground” that allows you to edit your code and watch how your changes influence your app in real-time. Xcode’s debugging console now also supports Swift syntax natively.

According to Apple, Swift will provide a number of significant speed advantages to developers. A complex object sort, for example, will run 3.9x faster than an implementation of the same algorithm in Python. That’s also faster than Objective-C, which is 2.8x faster than the Python version.

We will obviously need to take a closer look at this new programming language and how it relates to other languages. Apple is making the documentation available today, both as an iBook and on its developer site.

Objective-C was always a hard language to pick up for new developers. We will also have to see if Swift makes getting started with app development on Apple’s platforms easier, but from a first look at the documentation, it definitely feels more accessible than Objective-C.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: