Skip to content

An off-the-shelf timer/stopwatch to use in your iOS apps

License

Notifications You must be signed in to change notification settings

O-labib/BT-Timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BT-Timer

Version License Platform

Timer

Stopwatch

Timer

Setup

1- Initialize BTtimer specifying...

  • The label it should be linked to.
  • The time it should countdown.
  • whether the label should be animating or not.
  let timer:BTtimer!
  override func viewDidLoad() {
      ...
      timer = BTtimer(for: label, withTimeInSecs: 1 * 60 * 60, animate: true)
  }

2- Control the timer

  timer.fire()
  timer.pause()
  timer.stop()
  timer.reset()

3- Implement BTtimerDelegate with the available functions...

extension UIViewController : BTtimerDelegate {
    public func didStart() { }
    
    public func didTick(with secondsLeft: Int) { }
    
    public func didTimeOutWhileInBackground(since secondsPassed: Int) { }
    
    public func didTimeOut() { }
}

Stopwatch

Setup

1- Initialize BTstopwatch specifying...

  • The label it should be linked to.
  • whether the label should be animating or not.
  stopwatch:BTstopwatch!
  override func viewDidLoad() {
      ...
      stopwatch = BTstopwatch(for: label, animated: true)
  }

2- Control the timer

  stopwatch.fire()
  stopwatch.pause()
  stopwatch.stop()
  stopwatch.restart()

3- Implement StopwatchDelegate with the available functions...

extension UIViewController : StopwatchDelegate {
    public func stopwatchWasInterrupted(at timePassedInSec:Int) { }
}

Installation

BT-Timer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'BT-Timer'

Author

Omar Labib, [email protected]

License

BT-Timer is available under the MIT license. See the LICENSE file for more info.

About

An off-the-shelf timer/stopwatch to use in your iOS apps

Resources

License

Stars

Watchers

Forks

Packages

No packages published