Translate

June 4, 2014

Apple launches new Swift programming language for MAC OS X and iOS

Apple developers now have a new tool in their toolbox.

Switft, a new programming language that can power all of its devices. Swift is the successor to Objective-C, the venerable language that Apple has used to build apps for the Mac and iOS. Swift includes full support for Cocoa and Cocoa Touch, so developers can build apps for the iPad and iPhone.

Swift uses the same LLVM compiler that Apple uses for Objective-C, so developers can run Swift, Objective-C,  and C code all in the same program, and brings a number of improvements.

Swift seems to get rid of Objective C's reliance on defined pointers; instead, the compiler infers the variable type, just as many scripting languages do. At the same time, it provides modern features similar to those found in C++ and Java, like well-defined namespaces, generics, and operator overloading. From the few fragments of code shown during the demo, Swift appears to rely heavily on the dot-notation that Apple introduced in an earlier iteration of Objective C.

Apple showed off a couple of cases where implementing the same algorithm in Swift provided a speedup of about 1.3X compared to the same code implemented in Objective C. It also showed off a Swift "playground," where code is compiled as it's typed and the output is displayed in a separate pane of the editing window. The goal here is to allow developers to test code fragments without having to recompile an entire complex project.

The Swift Programming Language, This book is available for download with iBooks on your Mac or iOS device, and with iTunes on your computer. Books can be read with iBooks on your Mac or iOS device. Download link