I\'ve been searching for a way to use a Timer in Swift 4 and looked at this article. I test out my code in xcode and when the the timer first ticks (in this case after 10 se
Try this in swift 4
import UIKit
class ViewController: UIViewController {
var timer: Timer!
override func viewDidLoad() {
super.viewDidLoad()
self.timer = Timer.scheduledTimer(timeInterval: 10, target: self, selector: #selector(self.updateValue), userInfo: nil, repeats: true)
}
func updateValue(){
print("Timer is call")
}
}