Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
materik committed Mar 27, 2024
1 parent 9503b98 commit 21e6a22
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Sources/SnapshotTestCase/Snapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,14 @@ private extension Snapshot.TestCase {
guard let context = UIGraphicsGetCurrentContext() else {
throw SnapshotError.invalidContext
}


try await Task.sleep(for: .seconds(renderDelay))
await MainActor.run {
view.layer.render(in: context)
}
try await Task.sleep(for: .seconds(renderDelay))

let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
try await Task.sleep(for: .seconds(renderDelay))

guard let image else {
throw SnapshotError.takeSnapshot
Expand Down

0 comments on commit 21e6a22

Please sign in to comment.