How to get custom interaction events on the playground with Swift

I am trying to prototype a game with SpriteKit with Swift in the playground .

I'm having difficulty getting custom callback requests to work.

Here is 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 do not receive callbacks for the chain of responders. How can I enable this?

+6
source share
2 answers

User interaction is not available on Playgrounds (Source: WWDC).

+4
source

Playground user interactions are not available in Xcode 7.2 and below.

0
source

Source: https://habr.com/ru/post/971794/


All Articles