From 2cdaf4408e4a722fa4a0a36e7f86983c1f62d2b1 Mon Sep 17 00:00:00 2001 From: Teameh <1330668+teameh@users.noreply.github.com> Date: Fri, 15 Dec 2023 19:49:55 +0100 Subject: [PATCH] Fixing wkWebView.takeSnapshot with Xcode 14 & 15 This will fix this issue: https://github.com/pointfreeco/swift-snapshot-testing/issues/625 --- Sources/SnapshotTesting/Common/View.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/SnapshotTesting/Common/View.swift b/Sources/SnapshotTesting/Common/View.swift index 775072224..111f6af29 100644 --- a/Sources/SnapshotTesting/Common/View.swift +++ b/Sources/SnapshotTesting/Common/View.swift @@ -868,7 +868,11 @@ callback(Image()) return } - wkWebView.takeSnapshot(with: nil) { image, _ in + let configuration = WKSnapshotConfiguration() + if #available(iOS 13, macOS 10.15, *) { + configuration.afterScreenUpdates = false + } + wkWebView.takeSnapshot(with: configuration) { image, _ in callback(image!) } }