How can I make a function execute every second in swift?
You can use one like this: var timer = NSTimer() override func viewDidLoad() { scheduledTimerWithTimeInterval() } func scheduledTimerWithTimeInterval(){ // Scheduling timer to Call the function “updateCounting” with the interval of 1 seconds timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector(“updateCounting”), userInfo: nil, repeats: true) } func updateCounting(){ NSLog(“counting..”) } Swift 3: var timer = Timer() override … Read more