diff --git a/Sources/SnapshotTesting/Snapshotting/UIImage.swift b/Sources/SnapshotTesting/Snapshotting/UIImage.swift index e6ac25440..ef66aea28 100644 --- a/Sources/SnapshotTesting/Snapshotting/UIImage.swift +++ b/Sources/SnapshotTesting/Snapshotting/UIImage.swift @@ -25,6 +25,7 @@ extension Diffing where Value == UIImage { toData: { $0.pngData() ?? emptyImage().pngData()! }, fromData: { UIImage(data: $0, scale: imageScale)! } ) { old, new in + let old = UIImage(cgImage: old.cgImage!, scale: old.scale, orientation: new.imageOrientation) guard let message = compare(old, new, precision: precision, perceptualPrecision: perceptualPrecision) else { return nil } let difference = SnapshotTesting.diff(old, new) let oldAttachment = XCTAttachment(image: old)