Reputation: 71
I am using swift playgrounds on a mac and I chose the macOS option to make the application. I made an SKSpriteNode into an image an is set skNodeButton.isUserInteractionEnabled = true
However I can't use UIKit so it doesn't allow me to use the usual override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
is there anyway I can get a clicked node with cocoa or any other framework?
Upvotes: 1
Views: 109
Reputation: 6635
On macOS, SKSpriteNode
inherits from NSResponder
. You can override methods like mouseDown(with:NSEvent), mouseUp, mouseMoved
, etc.
Here's the documentation.
Upvotes: 1