I'm trying to experiment with recursive enums in Swift 2 however I'm getting compilation errors.
I started off trying to define my own example:
enum Tree {
case Empty
indirect case Node(value: Int, left: Tree, right: Tree)
}
But get an error: "Consecutive declarations on a line must be separated by :".
So, I tried Apple's own example from their WWDC15 What's New in Swift presentation:
enum Tree<T> {
case Leaf(T)
indirect case Node(Tree, Tree)
}
But its the same compilation error with this also. If I create a new playground and paste these lines in then it results in the error - see screenshot, or if in an Xcode project same thing, see other screenshot.
I'm using Xcode 7.0.
How come I can't even get Apple's example to compile?