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 HEIC 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-heic.git", revision: "0.0.1"),
- Link to Your Test Target: Add the HEICImageSerializer to your test target's dependencies:
.product(name: "HEICImageSerializer", package: "swift-snapshot-testing-plugin-heic"),
- Import and Set Up: In your test file, import the serializer and set the image format in the
setUp()
method:
import HEICImageSerializer
override class func setUp() {
SnapshotTesting.imageFormat = HEICImageSerializer.imageFormat
}
Important
On non Apple platform use this instead.
import HEICImageSerializer
override class func setUp() {
SnapshotTesting.imageFormat = HEICImageSerializer.imageFormat
PluginRegistry.registerPlugin(HEICImageSerializer.init())
}
- make the API ready for Swift 6 and async/throwing functions
- create a tests suite
- add documentations
- add tutorials