Timers.swift 616 B

1234567891011121314151617181920
  1. // LoopFollow
  2. // Timers.swift
  3. import Foundation
  4. extension MainViewController {
  5. func startGraphNowTimer(time: TimeInterval = 60) {
  6. graphNowTimer.invalidate()
  7. graphNowTimer = Timer.scheduledTimer(timeInterval: time,
  8. target: self,
  9. selector: #selector(MainViewController.graphNowTimerDidEnd(_:)),
  10. userInfo: nil,
  11. repeats: true)
  12. }
  13. @objc func graphNowTimerDidEnd(_: Timer) {
  14. chartModel.rebuild()
  15. }
  16. }