Significant Swift Beta 5 Changes

A little late, but I think worth doing. Here are the more significant changes in beta 5. 

  • Tidied optionals in many UIKit and Cocoa classes, more to come
  • You can no longer just test optionals with just 'if someOptional' you have to check against nil (e.g. 'if someOptional != nil'). Solves optional boolean ambiguities
  • ?? operator allows you to specify default values to use if optional IS nil e.g. let wobble = someOptionalString ?? "It was nil"
  • While we are here, lot's of protocols renamed (Type dropped as a suffix for example)
  • ! ? can now be assigned through allowing things like myDict["key"]?[4] = 6 which would only assign 6 to the fourth element of the array which is the value for "key" in the dictionary
  • Ranges split into three separate things: Ranges (a set of indexes), Intervals of comparable values which allows you to check if something is contained in the né Range, and Strideables and can be used iteration with arbitrary strides (increments). Very nice. 
  • Arrays have new first and last methods. About bloody time.
  • dynamic operator introduced which seems to make message sending a first class concept in swift and would seem to indicate an eventual ability to support it pure Swift
  • Attributes have been renamed (@auto_closure -> @autoclosure) and removed (@infix, etc) 
  • += now concatenates arrays, rather than appending an object. 

Well worth reading the whole document. I have to be honest, I'm impressed. Bravo Apple.