An extension to SnapshotTesting which allows you to create HEIC images. The benefit of using HEIC instead of PNG is that it can store as much as image quality as PNG, but with a smaller file size. You can verify this by looking at SnapshotTestingHEICTests.
Once installed, no additional configuration is required. You can import the SnapshotTestingHEIC
module, call SnapshotTesting
following their usage guide and simply provide our imageHEIC
strategy as below.
import XCTest
import SnapshotTesting
import SnapshotTestingHEIC
class MyViewControllerTests: XCTestCase {
func testMyViewController() {
let vc = MyViewController()
assertSnapshot(matching: vc, as: .imageHEIC)
}
}
⚠️ Warning: By default, Xcode will try to add the SnapshotTestingHEIC package to your project's main application/framework target. Please ensure that SnapshotTestingHEIC is added to a test target instead, as documented in the last step, below.
https://github.com/alexey1312/SnapshotTestingHEIC
If you want to use SnapshotTestingHEIC in any other project that uses Swift Package Manager, add the package as a dependency in Package.swift
:
dependencies: [
.package(name: "SnapshotTestingStitch", url: "https://github.com/alexey1312/SnapshotTestingHEIC.git", from: "1.0.0"),
]
Next, add SnapshotTestingHEIC
as a dependency of your test target:
targets: [
.target(
name: "MyApp"
),
.testTarget(
name: "MyAppTests",
dependencies: [
.target(name: "MyApp"),
.product(name: "SnapshotTestingHEIC", package: "SnapshotTestingHEIC"),
]
),
]
We do not currently support distribution through CocoaPods or Carthage.
This library is released under the MIT license. See LICENSE for details.
link |
Stars: 12 |
Last commit: 1 week ago |
Full Changelog: https://github.com/alexey1312/SnapshotTestingHEIC/compare/1.3.2...1.4.0
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics