I have a timer function that works in the viewcontroller.swift file here:
override func viewDidLoad() {
super.viewDidLoad()
//Swift 3 selector syntax
var timer = Timer.scheduledTimer(timeInterval: 0.4, target: self, selector: #selector(self.update), userInfo: nil, repeats: true)
}
// must be internal or public.
func update() {
// Something cool
}
I need to get it to work in my gamescene.swift file. This is what I had that wasn't working:
var currentTimeSeconds = 0
override public func didMove(to view: SKView) {
var timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(update), userInfo: nil, repeats: true)
}
public func update() {
currentTimeSeconds = currentTimeSeconds + 1
}
I keep getting the error "ambiguous use of 'update.'"