From b9c4eb3881d2b6bff567464deedda5f03678ed57 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 7 Jun 2025 17:33:40 +0800 Subject: [PATCH] Relax the protocol requirement for Snapshotting extension --- .../Documentation.docc/Articles/CustomStrategies.md | 2 +- Sources/SnapshotTesting/Snapshotting/NSView.swift | 4 ++-- Sources/SnapshotTesting/Snapshotting/NSViewController.swift | 4 ++-- Sources/SnapshotTesting/Snapshotting/UIView.swift | 4 ++-- Sources/SnapshotTesting/Snapshotting/UIViewController.swift | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/SnapshotTesting/Documentation.docc/Articles/CustomStrategies.md b/Sources/SnapshotTesting/Documentation.docc/Articles/CustomStrategies.md index 7a698fd79..2bbf66b8a 100644 --- a/Sources/SnapshotTesting/Documentation.docc/Articles/CustomStrategies.md +++ b/Sources/SnapshotTesting/Documentation.docc/Articles/CustomStrategies.md @@ -22,7 +22,7 @@ Snapshotting.image We can define an `image` strategy on `UIViewController` using the `pullback` method: ``` swift -extension Snapshotting where Value == UIViewController, Format == UIImage { +extension Snapshotting where Value: UIViewController, Format == UIImage { public static let image: Snapshotting = Snapshotting .image .pullback { viewController in viewController.view } diff --git a/Sources/SnapshotTesting/Snapshotting/NSView.swift b/Sources/SnapshotTesting/Snapshotting/NSView.swift index b2e7edfb0..acbcdd4ee 100644 --- a/Sources/SnapshotTesting/Snapshotting/NSView.swift +++ b/Sources/SnapshotTesting/Snapshotting/NSView.swift @@ -2,7 +2,7 @@ import AppKit import Cocoa - extension Snapshotting where Value == NSView, Format == NSImage { + extension Snapshotting where Value: NSView Format == NSImage { /// A snapshot strategy for comparing views based on pixel equality. public static var image: Snapshotting { return .image() @@ -47,7 +47,7 @@ } } - extension Snapshotting where Value == NSView, Format == String { + extension Snapshotting where Value: NSView, Format == String { /// A snapshot strategy for comparing views based on a recursive description of their properties /// and hierarchies. /// diff --git a/Sources/SnapshotTesting/Snapshotting/NSViewController.swift b/Sources/SnapshotTesting/Snapshotting/NSViewController.swift index 69ec72dde..f5566c472 100644 --- a/Sources/SnapshotTesting/Snapshotting/NSViewController.swift +++ b/Sources/SnapshotTesting/Snapshotting/NSViewController.swift @@ -2,7 +2,7 @@ import AppKit import Cocoa - extension Snapshotting where Value == NSViewController, Format == NSImage { + extension Snapshotting where Value: NSViewController, Format == NSImage { /// A snapshot strategy for comparing view controller views based on pixel equality. public static var image: Snapshotting { return .image() @@ -26,7 +26,7 @@ } } - extension Snapshotting where Value == NSViewController, Format == String { + extension Snapshotting where Value: NSViewController, Format == String { /// A snapshot strategy for comparing view controller views based on a recursive description of /// their properties and hierarchies. public static var recursiveDescription: Snapshotting { diff --git a/Sources/SnapshotTesting/Snapshotting/UIView.swift b/Sources/SnapshotTesting/Snapshotting/UIView.swift index 7244f67d1..a0329087c 100644 --- a/Sources/SnapshotTesting/Snapshotting/UIView.swift +++ b/Sources/SnapshotTesting/Snapshotting/UIView.swift @@ -1,7 +1,7 @@ #if os(iOS) || os(tvOS) import UIKit - extension Snapshotting where Value == UIView, Format == UIImage { + extension Snapshotting where Value: UIView, Format == UIImage { /// A snapshot strategy for comparing views based on pixel equality. public static var image: Snapshotting { return .image() @@ -44,7 +44,7 @@ } } - extension Snapshotting where Value == UIView, Format == String { + extension Snapshotting where Value: UIView, Format == String { /// A snapshot strategy for comparing views based on a recursive description of their properties /// and hierarchies. /// diff --git a/Sources/SnapshotTesting/Snapshotting/UIViewController.swift b/Sources/SnapshotTesting/Snapshotting/UIViewController.swift index 7b86e51aa..4f940f83f 100644 --- a/Sources/SnapshotTesting/Snapshotting/UIViewController.swift +++ b/Sources/SnapshotTesting/Snapshotting/UIViewController.swift @@ -1,7 +1,7 @@ #if os(iOS) || os(tvOS) import UIKit - extension Snapshotting where Value == UIViewController, Format == UIImage { + extension Snapshotting where Value: UIViewController, Format == UIImage { /// A snapshot strategy for comparing view controller views based on pixel equality. public static var image: Snapshotting { return .image() @@ -83,7 +83,7 @@ } } - extension Snapshotting where Value == UIViewController, Format == String { + extension Snapshotting where Value: UIViewController, Format == String { /// A snapshot strategy for comparing view controllers based on their embedded controller /// hierarchy. ///