swift , NSTimer, call function every 1 second


[/php]
class GameScene: SKScene {
override func didMoveToView(view: SKView) {
var timer = NSTimer()
  timer = NSTimer.scheduledTimerWithTimeInterval(1, target:self,
selector: Selector(“updateCounter”), userInfo: nil, repeats: true)
 }
func updateCounter() {
print(“get it”)
}

}
[/php]
call function every 1 second


Leave a Reply