From 91c15c21ed9c169b067a2a4e20c759aafbb57977 Mon Sep 17 00:00:00 2001 From: Vlad Suhomlinov <> Date: Mon, 16 Aug 2021 13:51:39 +0300 Subject: [PATCH] refactor: rename IInvalidatable -> Invalidatable --- .../Sources/TITimer/Sources/TITimer/Protocols/ITimer.swift | 2 +- .../Protocols/{IInvalidatable.swift => Invalidatable.swift} | 6 +++--- .../Sources/TITimer/Sources/TITimer/TITimer.swift | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) rename TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/{IInvalidatable.swift => Invalidatable.swift} (91%) diff --git a/TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/ITimer.swift b/TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/ITimer.swift index 40e073b4..5d5d4900 100644 --- a/TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/ITimer.swift +++ b/TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/ITimer.swift @@ -22,7 +22,7 @@ import Foundation -public protocol ITimer: IInvalidatable { +public protocol ITimer: Invalidatable { // Прошедшее время var elapsedTime: TimeInterval { get } diff --git a/TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/IInvalidatable.swift b/TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/Invalidatable.swift similarity index 91% rename from TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/IInvalidatable.swift rename to TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/Invalidatable.swift index c09803ec..2693149c 100644 --- a/TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/IInvalidatable.swift +++ b/TIFoundationUtils/Sources/TITimer/Sources/TITimer/Protocols/Invalidatable.swift @@ -22,7 +22,7 @@ import Foundation -public protocol IInvalidatable: AnyObject { +public protocol Invalidatable: AnyObject { // Уничтожить объект func invalidate() @@ -30,9 +30,9 @@ public protocol IInvalidatable: AnyObject { // MARK: - IInvalidatable -extension Timer: IInvalidatable { } +extension Timer: Invalidatable { } -extension DispatchSource: IInvalidatable { +extension DispatchSource: Invalidatable { public func invalidate() { setEventHandler(handler: nil) diff --git a/TIFoundationUtils/Sources/TITimer/Sources/TITimer/TITimer.swift b/TIFoundationUtils/Sources/TITimer/Sources/TITimer/TITimer.swift index bd0eea9d..cdef7749 100644 --- a/TIFoundationUtils/Sources/TITimer/Sources/TITimer/TITimer.swift +++ b/TIFoundationUtils/Sources/TITimer/Sources/TITimer/TITimer.swift @@ -28,7 +28,7 @@ public final class TITimer: ITimer { private let mode: TimerRunMode private let type: TimerType - private var sourceTimer: IInvalidatable? + private var sourceTimer: Invalidatable? private var enterBackgroundDate: Date? private var interval: TimeInterval = 0 @@ -152,7 +152,7 @@ private extension TITimer { private extension TITimer { - func startDispatchSourceTimer(interval: TimeInterval, queue: DispatchQueue) -> IInvalidatable? { + func startDispatchSourceTimer(interval: TimeInterval, queue: DispatchQueue) -> Invalidatable? { let timer = DispatchSource.makeTimerSource(flags: [], queue: queue) timer.schedule(deadline: .now() + interval, repeating: interval) timer.setEventHandler(handler: handleSourceUpdate) @@ -167,7 +167,7 @@ private extension TITimer { private extension TITimer { - func startTimer(interval: TimeInterval, runloop: RunLoop, mode: RunLoop.Mode) -> IInvalidatable { + func startTimer(interval: TimeInterval, runloop: RunLoop, mode: RunLoop.Mode) -> Invalidatable { let timer = Timer.scheduledTimer(withTimeInterval: interval, repeats: true) { [weak self] _ in self?.handleSourceUpdate() }