How to add tolerance to Timers in Swift?

Tolerance indicates the amount of time after the scheduled fire date, the timer may get fired. The timer may get fired at any time between the scheduled fire date and scheduled fire date + tolerance. Providing a tolerance value will enhance the system responsiveness and increased power savings. Adding tolerance to Swift timers neither cause timer to fire early nor it will allow timer to drift.The system may also add additional delay to timers even if tolerance property is set.


Example code snippet using Swift playground.






Leave a Reply