Home Trying to use a for loop to cycle through repeating timers in swift
 I have 2 timers setup one at 20 seconds the other at 60 I need to repeat these in a loop 6 times, such as 20 then 60 and repeat but cannot seem to do so. Every time I place them in the loop the timer accelerates. It should call timer1() then timer2() and repeat but I'm not sure why its not.  for _ in 1...6 { timer1() let when = DispatchTime.now() + 19 DispatchQueue.main.asyncAfter(deadline: when) { self.timer2() } } func timer1() { beginnerStart() beginnerTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ViewController.beginnerStart), userInfo: nil, repeats: true) @objc func beginnerStart() { warmUpCountDown = warmUpCountDown - 1 if warmUpCountDown == 0 { beginnerTimer.invalidate() }