diff --git a/Sources/SnapshotTesting/Snapshotting/UIViewController.swift b/Sources/SnapshotTesting/Snapshotting/UIViewController.swift index b08b8bf59..7b86e51aa 100644 --- a/Sources/SnapshotTesting/Snapshotting/UIViewController.swift +++ b/Sources/SnapshotTesting/Snapshotting/UIViewController.swift @@ -11,6 +11,9 @@ /// /// - Parameters: /// - config: A set of device configuration settings. + /// - drawHierarchyInKeyWindow: Utilize the simulator's key window in order to render + /// `UIAppearance` and `UIVisualEffect`s. This option requires a host application for your + /// tests and will _not_ work for framework test targets. /// - precision: The percentage of pixels that must match. /// - perceptualPrecision: The percentage a pixel must match the source pixel to be considered a /// match. 98-99% mimics @@ -20,6 +23,7 @@ /// - traits: A trait collection override. public static func image( on config: ViewImageConfig, + drawHierarchyInKeyWindow: Bool = false, precision: Float = 1, perceptualPrecision: Float = 1, size: CGSize? = nil, @@ -34,7 +38,7 @@ 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