Swift gets swifter: Apple updates its new programming language

Better Objective C interop, fixes and new features in Swift 1.2

Swift programming language

Apple's Swift programming language has been enhanced with new features and an upgraded compiler, in the just-released beta version of Xcode 6.3.

Swift was announced at Apple’s WWDC event in June 2014 and version 1.0 was released with Xcode 6.0 (Apple’s IDE for OSX and iOS) in September 2014, with version 1.1 following soon after. It is a modern, safer alternative to Objective-C, and compiles to native code using the open source LLVM compiler.

The newly released Swift 1.2 has better interoperability with Objective-C, including the ability to export enums to Objective-C, and on the Objective-C side, the ability to define nullable pointers and blocks. This makes it easier to write Swift code that uses Objective-C libraries.

There is also a new Set data structure, for collections of unique elements, which bridges with NSSet in Objective-C.

Other enhancements cover let constants, static methods and properties in classes, and type inference for closures. There are also several language changes to tighten up Swift and make it more consistent, and some fixes for previous incorrect behaviour. Full details are in the Xcode 6.3 beta release notes on Apple’s developer site.

A source code migrator tool in Xcode 6.3 converts source code from Swift 1.1 to 1.2.

The 1.2 compiler now features incremental builds, improving build times by not recompiling unchanged files, as well as better optimization, diagnostics and stability.

Swift has been taken up rapidly by developers. Redmonk’s Stephen O’Grady ranks languages according to their popularity on the GitHub code repository and the Stack Overflow programming community. Objective C is ranked at 10 in January 2015, but O’Grady writes that:

“The growth that Swift experienced is essentially unprecedented in the history of these rankings.. Swift has gone from our 68th ranked language during Q3 to number 22 this quarter, a jump of 46 spots … Given this dramatic ascension, it seems reasonable to expect that the Q3 rankings this year will see Swift as a Top 20 language.”

Swift growth or what?

More information is on the official Swift blog here

Sponsored: Minds Mastering Machines - Call for papers now open




Biting the hand that feeds IT © 1998–2018