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() { }
}
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) { }
}
BT-Timer is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'BT-Timer'
Omar Labib, o.labib1995@gmail.com
BT-Timer is available under the MIT license. See the LICENSE file for more info.