Skip to content

Instantly share code, notes, and snippets.

@Shilo
Created June 6, 2022 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shilo/3051650f3f889d30ddb4d9e10e3335f4 to your computer and use it in GitHub Desktop.
Save Shilo/3051650f3f889d30ddb4d9e10e3335f4 to your computer and use it in GitHub Desktop.
Swift extension for Task sleeping in milliseconds.
//
// Task+Addition.swift
//
//
// Created by Shilo White on 6/5/22.
//
import Foundation
public extension Task where Success == Never, Failure == Never {
static func sleep(milliseconds duration: UInt64) async throws {
try await sleep(nanoseconds: duration * 1000000)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment