Skip to content

Instantly share code, notes, and snippets.

@aniltv06
Created September 8, 2016 10:01
Show Gist options
  • Save aniltv06/3fca938e965595cd2afacfcf737cb07c to your computer and use it in GitHub Desktop.
Save aniltv06/3fca938e965595cd2afacfcf737cb07c to your computer and use it in GitHub Desktop.
Add NSTimer in swift
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
_ = NSTimer.scheduledTimerWithTimeInterval(1.0/30.0, target: self, selector: #selector(ViewController.methodName), userInfo: nil, repeats: true)
}
func methodName(){
print("Method Called")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment