yattee/Shared/Delay.swift
2022-08-26 23:09:45 +02:00

8 lines
236 B
Swift

import Foundation
struct Delay {
@discardableResult static func by(_ interval: TimeInterval, block: @escaping () -> Void) -> Timer {
Timer.scheduledTimer(withTimeInterval: interval, repeats: false) { _ in block() }
}
}