//
// Timer+startTimer.swift
// IceGlass
//
// Copyright 2026 Rouslan Zenetl. All Rights Reserved.
//

import Foundation

extension Timer {
    static func startTimer(timer: Timer?, interval: TimeInterval, action: @escaping @Sendable (Timer) -> Void) -> Timer {
        timer?.invalidate()
        return Timer.scheduledTimer(
            withTimeInterval: interval,
            repeats: true,
            block: action
        )
    }
}
