Swift: 1.2 has dropped

Just a few points. I haven’t been able to spend any time testing yet:

  • There’s a migration tool to enable you to port your code from older versions of Swift to 1.2. HOWEVER, the release notes point out that “Convert to Swift 1.2” may generate build errors when run so coder beware.
  • Swift now supports building targets incrementally. HELLS yes. It no longer should re-build every single file every single time you add a new punctuation mark somewhere.
  • Set now joins the built-in array and dictionary.
  • I am all \o/ over this next one: “if let” now lets you do multiple steps and avoid the PYRAMID OF DOOOOOOOM!
  if let a = foo(), b = bar() where a < b, let c = baz() {
      ...blah blah ...} 
  • Let constants won’t require you to immediately initialize them, so you “set once, use mostly” (SEUM?) pattern with lets. This presumably continues to allow compiler optimization because once set you won’t be mutating the value (although if its a container, you can of course continue to mutate the contents it points to)
  • You can now have static properties and methods in classes, with lazy initialization, global storage. The release notes point out this is an alias for “class final”.
  • There’s some improved closure type inferencing. I mostly tl;dr’ed this. I’ll get back to it when I have a moment.
  • Swift enums can now export to ObjectiveC. I know this has been a bugaboo for a lot of frustrated people. They’ll import as NS_ENUM stuff.
  • I’ll just quote this next one in full: “Objective-C language extensions are now available to indicate the nullability of pointers and blocks in Objective-C APIs, allowing your Objective-C APIs to be imported without ImplicitlyUnwrappedOptional.”
  • Even better, Swift can now import (well, partially import) C unions, bitfields, and other features not natively supported in Swift. David G. is going “eep eep” with happiness right now. C-structs will be zero’ed on your behalf.
  • .self stuff is now automagically demangled. Thank you, Apple.
  • There’s a new @noescape attribute, which with its kafka-esque name, has to do with function closure parameters. Basically, the closure will be deallocated (if I’m reading this right, am I reading this right?) when the function ends, so you’ll only want to use synchronous stuff. It also takes care of self. issues.
  • There are some language tweaks, the ones that affect me most are the change in @autoclosure and argument labels for curried functions.