Skip to content

Latest commit

 

History

History
97 lines (76 loc) · 2.22 KB

README.md

File metadata and controls

97 lines (76 loc) · 2.22 KB

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.