Skip to content

Commit

Permalink
Use fix from other PR pointfreeco#692 and inject `drawHierarchyInKeyW…
Browse files Browse the repository at this point in the history
…indow` on UIViewController
  • Loading branch information
Ton Heijligers committed Aug 17, 2023
1 parent dc46eeb commit 9b16c04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Sources/SnapshotTesting/Common/View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,13 @@ extension View {
return
}
wkWebView.takeSnapshot(with: nil) { image, _ in
callback(image!)
let configuaration = WKSnapshotConfiguration()
if #available(iOS 13, macOS 10.15, *) {
configuaration.afterScreenUpdates = false
}
wkWebView.takeSnapshot(with: configuaration) { image, _ in
callback(image!)
}
}
}
} else {
Expand Down
3 changes: 2 additions & 1 deletion Sources/SnapshotTesting/Snapshotting/UIViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extension Snapshotting where Value == UIViewController, Format == UIImage {
/// - traits: A trait collection override.
public static func image(
on config: ViewImageConfig,
drawHierarchyInKeyWindow: Bool = false,
precision: Float = 1,
perceptualPrecision: Float = 1,
size: CGSize? = nil,
Expand All @@ -27,7 +28,7 @@ extension Snapshotting where Value == UIViewController, Format == UIImage {
return SimplySnapshotting.image(precision: precision, perceptualPrecision: perceptualPrecision, scale: traits.displayScale).asyncPullback { viewController in
snapshotView(
config: size.map { .init(safeArea: config.safeArea, size: $0, traits: config.traits) } ?? config,
drawHierarchyInKeyWindow: false,
drawHierarchyInKeyWindow: drawHierarchyInKeyWindow,
traits: traits,
view: viewController.view,
viewController: viewController
Expand Down

0 comments on commit 9b16c04

Please sign in to comment.