Skip to content

Commit b2d4cb3

Browse files
authored
Adds drawHierarchyInKeyWindow parameter (#801)
1 parent f5bfff7 commit b2d4cb3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/SnapshotTesting/Snapshotting/UIViewController.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
///
1212
/// - Parameters:
1313
/// - config: A set of device configuration settings.
14+
/// - drawHierarchyInKeyWindow: Utilize the simulator's key window in order to render
15+
/// `UIAppearance` and `UIVisualEffect`s. This option requires a host application for your
16+
/// tests and will _not_ work for framework test targets.
1417
/// - precision: The percentage of pixels that must match.
1518
/// - perceptualPrecision: The percentage a pixel must match the source pixel to be considered a
1619
/// match. 98-99% mimics
@@ -20,6 +23,7 @@
2023
/// - traits: A trait collection override.
2124
public static func image(
2225
on config: ViewImageConfig,
26+
drawHierarchyInKeyWindow: Bool = false,
2327
precision: Float = 1,
2428
perceptualPrecision: Float = 1,
2529
size: CGSize? = nil,
@@ -34,7 +38,7 @@
3438
snapshotView(
3539
config: size.map { .init(safeArea: config.safeArea, size: $0, traits: config.traits) }
3640
?? config,
37-
drawHierarchyInKeyWindow: false,
41+
drawHierarchyInKeyWindow: drawHierarchyInKeyWindow,
3842
traits: traits,
3943
view: viewController.view,
4044
viewController: viewController

0 commit comments

Comments
 (0)