/TITimer

Pretty timer ⏰

Primary LanguageSwiftApache License 2.0Apache-2.0

TITimer

Pretty timer ⏰

The library allows you to create a timer that works either with RunLoop or with GCD.

Features

  • Track the time even while the application is in the background. For more, see - TimerRunMode
  • Create a timer on a personal queue or on a special Runloop mode. For more, see - TimerType
  • The code is covered by tests 🙂

Examples

RunLoop

timer = TITimer(type: .runloopTimer(runloop: .current, mode: .default), mode: .activeAndBackground)
        
timer.eventHandler = {
   // handle elapsed time
}
        
timer.start()
timer.invalidate()

GCD

timer = TITimer(type: .dispatchSourceTimer(queue: .main), mode: .activeAndBackground)
        
timer.eventHandler = {
   // handle elapsed time
}
        
timer.start()
timer.invalidate()