Blake Merryman

My thoughts & ideas.

Swift 1.2

I’m really excited about the changes to Swift in the current Xcode 6.3 beta. Apple has answered several of my biggest gripes with Swift. Here are some of the highlights:

  • Incremental builds for increased build performance
  • Native Set collection class that bridges to NSSet, joining Array/NSArray and Dictionary/NSDictionary
  • static methods and properties support for classes
  • Improved type inference for single-expression closures
  • Swift enums can now be exported to Objective-C
  • let constants no longer need immediate initialization
  • General performance enhancements
  • General improvements to Swift-Objective-C interoperability

And my personal favorite:

  • Nested & enhanced optional binding

Now, this:

if let x = self.x {
    if let y = self.y {
        if let z = self.z {
            if z == true {
                // Do something at the top of the Pyramid of Doom!

becomes this:

if let x = self.x, y = self.y, z = self.z where z == true {
    // Do Something without climbing the Pyramid!


Apple has even included a handy Migration Tool to get your code from Swift version 1.1 to version 1.2.

There are a lot of other great changes as well (including enhancements to Objective-C) so head over to the Apple Developer Center to download the beta and read the full release notes.