Apple releases ‘noteworthy’ update to Swift programming language, new Xcode beta
Even though Apple hasn’t shipped iOS 8.2 yet, the company today made available iOS 8.3 beta to developers. The update comes alongside a new build of Xcode which includes a number of changes to the Swift programming language.
In a post to Apple’s Swift blog today, the company said that the Xcode release brings a “enhanced Swift compiler” along with new features like incremental code builds, faster executables, better diagnostics and a number of stability improvements.
On the Swift side of things, there are a number of changes to the language which are meant to ensure “safe and predictable behavior” and to “improve interaction between Swift and Objective-C.”
Apple notes the changes include “source-incompatible” changes, which means developers will need to update their code, but the new version of Xcode includes a migrator to help with the process.
iOS 8.3 also reportedly includes support for Google accounts with two-factor enabled.
The Swift 1.2 compiler was engineered to be more stable and to improve performance in every way. These changes also provide a better experience when working with Swift in Xcode. Some of the most visible improvements include:
- Incremental builds — Source files that haven’t changed will no longer be re-compiled by default, which will significantly improve build times for most common cases. Larger structural changes to your code may still require multiple files to be rebuilt.
- Faster executables — Debug builds produce binaries that run considerably faster, and new optimizations deliver even better Release build performance.
- Better compiler diagnostics — Clearer error and warning messages, along with new Fix-its, make it easier to write proper Swift 1.2 code.
- Stability improvements — The most common compiler crashes have been fixed. You should also see fewer SourceKit warnings within the Xcode editor.
New language features
In Swift 1.2, the language has been further refined to ensure safe, predictable behavior. We also continue to improve the interaction between Swift and Objective-C. Some of the more notable changes include:
- as! for failable casts — Casts that can fail at runtime are now expressed with the new as!operator to make their potential for runtime failure clear to readers and maintainers of your code.
- Nullability may now be expressed in Objective-C headers — New Objective-C extensions in Clang allow you to express the nullability of pointers and blocks in your Objective-C API. You can provide Objective-C frameworks that work great with Swift code, and improve your Swift experience when mixing and matching with Objective-C code in your own project.