Important
- This is a prototype implementation to test the
ImagePluginAPI
ofswift-snapshot-testing
.
This repo is an experimental use of this branch(pointfreeco/swift-snapshot-testing#904) that contains a PluginAPI for swift-snapshot-testing
.
The goal of this is to show how easy it is to build a plugin.
To utilize the WEBP image serializer in your tests, follow these steps:
-
Add the Dependency: Include this project as a dependency in your
Package.swift
file:.package(url: "https://github.com/mackoj/swift-snapshot-testing-plugin-webp.git", revision: "0.0.1"),
-
Link to Your Test Target: Add the WEBPImageSerializer to your test target's dependencies:
.product(name: "WEBPImageSerializer", package: "swift-snapshot-testing-plugin-webp"),
-
Import and Set Up: In your test file, import the serializer and set the image format in the
setUp()
method:
import WEBPImageSerializer
override class func setUp() {
SnapshotTesting.imageFormat = WEBPImageSerializer.imageFormat
}
Important
On non Apple platform use this instead.
import HEICImageSerializer
override class func setUp() {
SnapshotTesting.imageFormat = WEBPImageSerializer.imageFormat
PluginRegistry.registerPlugin(WEBPImageSerializer.init())
}
- use webp directly
- make the API ready for Swift 6 and async/throwing functions
- create a tests suite
- add documentations
- add tutorials