From d23257e963d66036d987d2cd738b49fd7923a822 Mon Sep 17 00:00:00 2001 From: Vlad Suhomlinov Date: Thu, 16 Sep 2021 00:59:21 +0300 Subject: [PATCH] refactor: correct self capture --- .../Sources/TITimer/Sources/TITimer/TITimer.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TIFoundationUtils/Sources/TITimer/Sources/TITimer/TITimer.swift b/TIFoundationUtils/Sources/TITimer/Sources/TITimer/TITimer.swift index cdef7749..fe89c6f3 100644 --- a/TIFoundationUtils/Sources/TITimer/Sources/TITimer/TITimer.swift +++ b/TIFoundationUtils/Sources/TITimer/Sources/TITimer/TITimer.swift @@ -155,7 +155,9 @@ private extension TITimer { 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) + timer.setEventHandler() { [weak self] in + self?.handleSourceUpdate() + } timer.resume()