amplify-swift/Amplify/Core/Support/Task+Seconds.swift

16 lines
387 B
Swift

//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
import Foundation
public extension Task where Success == Never, Failure == Never {
static func sleep(seconds: Double) async throws {
let nanoseconds = UInt64(seconds * Double(NSEC_PER_SEC))
try await Task.sleep(nanoseconds: nanoseconds)
}
}