I have a function like below:
func startTimer() {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
DispatchQueue.main.async {
appDelegate.TIMER = Timer.scheduledTimer(withTimeInterval: self.REPEAT_TIME, repeats: true, block: { timer in
self.sendData(programID: self.MAIN_THREAD)
do {
try ...
}
catch let error {
...
}
})
}
}
Timer Stop Function:
func stopTimer() {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
if (appDelegate.TIMER != nil) {
appDelegate.TIMER?.invalidate()
appDelegate.TIMER = nil
}
}
I want to know that
is there any chance to start multiple timer instances if I call this function without stopping?
And how about this case,(does this stopped only one timer & continue running another timer?)
Start the timer → Start again → Stop