ios - Do something every x minutes in Swift -


how can run function every minute? in javascript can setinterval, similar exist in swift?

wanted output:

hello world once minute...

var helloworldtimer = nstimer.scheduledtimerwithtimeinterval(60.0, target: self, selector: selector("sayhello"), userinfo: nil, repeats: true)  func sayhello()  {     nslog("hello world") } 

remember import foundation.

swift 3:

 var helloworldtimer = timer.scheduledtimer(timeinterval: 60.0, target: self, selector: #selector(viewcontroller.sayhello), userinfo: nil, repeats: true)   func sayhello()   {      nslog("hello world")  } 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -