I'm trying to prototype a game with SpriteKit
with Swift
in a playground
.
I'm having difficulties getting the user touch callbacks to work.
Here's what I am trying :
let view:SKView = SKView(frame: CGRectMake(0, 0, 320, 586))
XCPShowView("Live view", view)
class PrototypeScene: SKScene {
override func didMoveToView(view: SKView) {
self.userInteractionEnabled = true
}
override func touchesBeganWithEvent(event: NSEvent!)
{
println("Hello touches")
}
}
let scene:PrototypeScene = PrototypeScene(size: CGSizeMake(320, 586))
scene.scaleMode = SKSceneScaleMode.AspectFit
view.presentScene(scene)
I'm not getting the callbacks for the responder chain. How would one enable this?
User interaction is not available in Playgrounds (Source: WWDC).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With