What does this not work?
enum Aspect : CGFloat {
case Clockwise = 1.0
case Anticlockwise = -1.0
}
On Anticlockwise line I'm told that 'raw value for enum case must be a literal'
What does this not work?
enum Aspect : CGFloat {
case Clockwise = 1.0
case Anticlockwise = -1.0
}
On Anticlockwise line I'm told that 'raw value for enum case must be a literal'
That sounds like a bug. However it seems to work if you omit the decimal part:
This has been fixed in Swift 1.2 (Xcode 6.3 beta). From the release notes:
So your code now compiles and works without problems, and you can now also define non-integral negative enumeration values, which was not possible before:
The weird thing is that a float with a minus is not a literal, but an expression. So the error message is correct.
From the Swift programming language: