Calling Function from another class swift

In GameViewController you have defined scoreAction as instance method not the class function.You should call scoreAction by making instance of GameViewController

class Menu: SKnode {

    func scoreAction(sender:UIButton!) { 
        self.buttonPlay.removeFromSuperview()
        self.buttonScore.removeFromSuperview()
         // CALLING FUNCTION 
         //see () on GameViewController
        GameViewController().showLeaderboard()    
     }
}

I think you should load GameViewController from storyBoard if you have GameViewController in storyBoard

Leave a Comment