Skip to content

Instantly share code, notes, and snippets.

@josephlord
Created February 18, 2015 00:06
Show Gist options
  • Save josephlord/2bbfcf4a964804181dad to your computer and use it in GitHub Desktop.
Save josephlord/2bbfcf4a964804181dad to your computer and use it in GitHub Desktop.
Swift 1.2 beta required code changes and bugs
// Will be fixed
let sub:SubClass = s as? SubClass ?? SubClass(2)
// Use this for Beta 1
let sub:SubClass = (s as? SubClass) ?? SubClass(2)
// Setup
let dict:[String:Int]? = ["a":1, "b":2]
// Swift 1.1 - Removed
let x:Int? = dict.map { $0["a"] }?
// Swift 1.2
let x:Int? = dict.map { $0["a"] } ?? nil
"fooübar".uppercaseString // Crashes - Fixed in next beta
let s:String = NSString() // requires "as String" cast in Swift 1.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment