Skip to content

Commit 99426bb

Browse files
authored
Fix Task.sleep deprecation warnings (#911)
1 parent 8af720a commit 99426bb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Examples/CaseStudies/SwiftUICaseStudies/FactClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extension FactClient {
2121
.data(from: URL(string: "http://numbersapi.com/\(number)/trivia")!)
2222
return String(decoding: data, as: UTF8.self)
2323
} catch {
24-
await Task.sleep(NSEC_PER_SEC)
24+
try? await Task.sleep(nanoseconds: NSEC_PER_SEC)
2525
return "\(number) is a good number Brent"
2626
}
2727
}

Tests/ComposableArchitectureTests/EffectTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ final class EffectTests: XCTestCase {
258258
@Sendable func work() async throws -> Int {
259259
var task: Task<Int, Error>!
260260
task = Task {
261-
await Task.sleep(NSEC_PER_MSEC)
261+
try? await Task.sleep(nanoseconds: NSEC_PER_MSEC)
262262
try Task.checkCancellation()
263263
return 42
264264
}

0 commit comments

Comments
 (0)