Search code examples
xcodeswiftswift-playground

Swift Version 1.2 not available in the playgrounds of Xcode 6.3?


One of the new features on Xcode 6.3 Beta (6D520o) supposed to be a changed behavior of the let statement. With Swift 1.2 you should be able to assign a value to a let constant later on. Not only with the declaration. As long as you initialized a value before use all should be fine. But with my little test I still get the same error I got in the past.

let edge : CGFloat
edge = CGFloat(44.55)
println(edge)

Can not assign to ‚let‘ value 'edge'

Are Xcode 6.3 Beta playgrounds still using Swift 1.1 and not 1.2? In my Xcode I have the menu item „Convert > To Swift 1.2“ but it is disabled.

It the any way to get an output of the current version number from Swift itself?


Solution

  • This technique does not currently work for globals, and thus, due to the way playgrounds work, does not work in playgrounds for the same technical reason. It should work if you put the same piece of code in a function, however. (forum thread)