forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpriteKit.swift
32 lines (26 loc) · 904 Bytes
/
SpriteKit.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@_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
nodes.append(node)
}
return nodes
}
}
}