Files
swift-mirror/stdlib/public/SDK/SpriteKit/SpriteKit.swift
Chris Lattner 31c01eab73 Change the meaning of "if let x = foo()" back to Xcode 6.4 semantics. The compiler
includes a number of QoI things to help people write the correct code.  I will commit
the testcase for it as the next patch.

The bulk of this patch is moving the stdlib, testsuite and validation testsuite to
the new syntax.  I moved a few uses of "as" patterns back to as? expressions in the 
stdlib as well.



Swift SVN r27959
2015-04-30 04:38:13 +00:00

33 lines
920 B
Swift

@exported import SpriteKit
// SpriteKit defines SKColor using a macro.
#if os(OSX)
public typealias SKColor = NSColor
#elseif os(iOS) || os(tvOS)
public typealias SKColor = UIColor
#endif
// this class only exists to allow AnyObject lookup of _copyImageData
// since that method only exists in a private header in SpriteKit, the lookup
// mechanism by default fails to accept it as a valid AnyObject call
@objc class _SpriteKitMethodProvider : NSObject {
override init() { _sanityCheckFailure("don't touch me") }
@objc func _copyImageData() -> NSData! { return nil }
}
extension SKNode {
public subscript (name: String) -> [SKNode] {
// Note: Don't stomp on objectForKeyedSubscript:
@objc(_swiftObjectForKeyedSubscript:) get {
var nodes = [SKNode]()
enumerateChildNodesWithName(name) { node, stop in
if let n = node { nodes.append(n) }
}
return nodes
}
}
}