In an Xcode project I have a button that runs a function that retrieves the number of followers of an instagram account each 18.5 seconds.
@IBAction func run(_ sender: UIButton) {
updateLabel()
Timer.scheduledTimer(timeInterval: 18.5, target: self, selector: (#selector(ViewController.updateLabel)), userInfo: nil, repeats: true)
stop.isHidden = false
}
I would like to add a button stoprun stopping the retrieving of the followers when pressed.
Do you think there is a way to stop this kind of function?