yattee/Shared/Delay.swift

8 lines
234 B
Swift
Raw Normal View History

2022-08-25 17:09:55 +00:00
import Foundation
2024-02-01 22:51:41 +00:00
enum Delay {
2022-08-25 17:09:55 +00:00
@discardableResult static func by(_ interval: TimeInterval, block: @escaping () -> Void) -> Timer {
Timer.scheduledTimer(withTimeInterval: interval, repeats: false) { _ in block() }
}
}