diff --git a/Sources/SnapshotTesting/Snapshotting/SwiftUIView.swift b/Sources/SnapshotTesting/Snapshotting/SwiftUIView.swift index 8d85e1f0b..0fbe5cb41 100644 --- a/Sources/SnapshotTesting/Snapshotting/SwiftUIView.swift +++ b/Sources/SnapshotTesting/Snapshotting/SwiftUIView.swift @@ -25,6 +25,14 @@ /// A snapshot strategy for comparing SwiftUI Views based on pixel equality. /// + /// If you are using a host application we recommend that you set + /// `drawHierarchyInKeyWindow` to `true` to capture the most accurate + /// snapshots. Setting it to `false` can result in snapshots that don't look + /// exactly like your user interface. Examples we've seen are tab bars that + /// don't have the right color for their unselected tabs, lists that have + /// corner radii on every row instead of only on the top and bottom rows, + /// and rounded rectangles that have rendering artifacts. + /// /// - Parameters: /// - drawHierarchyInKeyWindow: Utilize the simulator's key window in order to render /// `UIAppearance` and `UIVisualEffect`s. This option requires a host application for your diff --git a/Sources/SnapshotTesting/Snapshotting/UIView.swift b/Sources/SnapshotTesting/Snapshotting/UIView.swift index 7244f67d1..d4fac1138 100644 --- a/Sources/SnapshotTesting/Snapshotting/UIView.swift +++ b/Sources/SnapshotTesting/Snapshotting/UIView.swift @@ -9,6 +9,14 @@ /// A snapshot strategy for comparing views based on pixel equality. /// + /// If you are using a host application we recommend that you set + /// `drawHierarchyInKeyWindow` to `true` to capture the most accurate + /// snapshots. Setting it to `false` can result in snapshots that don't look + /// exactly like your user interface. Examples we've seen are tab bars that + /// don't have the right color for their unselected tabs, lists that have + /// corner radii on every row instead of only on the top and bottom rows, + /// and rounded rectangles that have rendering artifacts. + /// /// - Parameters: /// - drawHierarchyInKeyWindow: Utilize the simulator's key window in order to render /// `UIAppearance` and `UIVisualEffect`s. This option requires a host application for your diff --git a/Sources/SnapshotTesting/Snapshotting/UIViewController.swift b/Sources/SnapshotTesting/Snapshotting/UIViewController.swift index b08b8bf59..5dafd7c1d 100644 --- a/Sources/SnapshotTesting/Snapshotting/UIViewController.swift +++ b/Sources/SnapshotTesting/Snapshotting/UIViewController.swift @@ -9,6 +9,18 @@ /// A snapshot strategy for comparing view controller views based on pixel equality. /// + /// This strategy trades image accuracy for the flexibility to use this + /// strategy inside of framework and package test targets. This can result + /// in snapshots that don't look exactly like the user interface they are + /// snapshotting. Examples we've seen are tab bars that don't have the right + /// color for their unselected tabs, lists that have corner radii on every + /// row instead of only on the top and bottom rows, and rounded rectangles + /// that have rendering artifacts. + /// + /// For more accurate snapshots use a host application for your tests with + /// the ``image(drawHierarchyInKeyWindow:precision:perceptualPrecision:size:traits:)`` + /// method and pass `true` to the `drawHierarchyInKeyWindow` parameter. + /// /// - Parameters: /// - config: A set of device configuration settings. /// - precision: The percentage of pixels that must match. @@ -44,6 +56,14 @@ /// A snapshot strategy for comparing view controller views based on pixel equality. /// + /// If you are using a host application we recommend that you set + /// `drawHierarchyInKeyWindow` to `true` to capture the most accurate + /// snapshots. Setting it to `false` can result in snapshots that don't look + /// exactly like your user interface. Examples we've seen are tab bars that + /// don't have the right color for their unselected tabs, lists that have + /// corner radii on every row instead of only on the top and bottom rows, + /// and rounded rectangles that have rendering artifacts. + /// /// - Parameters: /// - drawHierarchyInKeyWindow: Utilize the simulator's key window in order to render /// `UIAppearance` and `UIVisualEffect`s. This option requires a host application for your