Tuesday, 28 May 2019

Why timer invoke its block so quickly sometimes

I create a timer and invoke its block every 5 second. Then I make application to enter background and enter foreground after a while. But it could invoke the block quickly sometimes.

let _ = Timer.scheduledTimer(withTimeInterval: 5.0, repeats: true) { (timer) in
        print("--------")
   }

When I enter foreground the interval of first printing and second printing may less than a second sometimes. Is time interval invalid in this case?



from Why timer invoke its block so quickly sometimes

No comments:

Post a Comment