user22530416
user22530416

Reputation:

How to detect the location of a mouseDown event for a iOS App using Swift?

How to detect the location of a mouseDown event for a iOS App using Swift?

With the following code snippet, I get the error "Value of type 'UIEvent' has no member 'location' in scope"?

import SpriteKit

extension GameViewController {
    
        func mouseDown(with event: UIEvent) {
            
            if let ourScene = GameScene(fileNamed: "GameScene") {
                
                // error here:
                let location = event.location(in: view)
                let node:SKNode = ourScene.atPoint(location)
                
                if (node.name == "creditsInfo") {
                    showCredits()
                }
                
            }   // if let ourScene
    
        }   // mouseDown
    
    }

Anybody have a floodlight to shine on this very basic error?

Upvotes: 1

Views: 112

Answers (0)

Related Questions