yattee/Shared/Delay.swift

8 lines
236 B
Swift
Raw Normal View History

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