Swift: I upgrade my hate level for #available

The Xcode 7 playground cannot run any firmware other than iOS 9. For example, add the available check, the playground goes all misty eyed and innocent asking “Why did you do that?”

Screen Shot 2015-06-11 at 4.10.37 PM

Why? You evil thing? Because the second I take out that check, you freak out everywhere:

SpriteStuff.playground:61:23: error: ‘GKGraphNode2D’ is only available on iOS 9.0 or newer
var graphNodes = [GKGraphNode2D]()
^
SpriteStuff.playground:61:23: note: guard with version check
var graphNodes = [GKGraphNode2D]()
^
SpriteStuff.playground:67:16: error: ‘GKPath’ is only available on iOS 9.0 or newer
let path = GKPath(graphNodes: graphNodes, radius: (starNode.position.distanceToPoint(CGPointZero) / 10.0).floatValue)
^

And so forth. Going on for pages.

#available and I are not friends. I think it hates me.

Update:

Comments are closed.