Loupehope / TITimer

Pretty timer ⏰

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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()

About

Pretty timer ⏰

License:Apache License 2.0


Languages

Language:Swift 100.0%