Skip to content

Commit 28be538

Browse files
authored
Update README.md
1 parent 42bd1f5 commit 28be538

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

README.md

+29-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,40 @@
11
# swift-snapshot-testing-plugin-heic
22

3-
# swift-snapshot-testing-plugin-heic
4-
53
This repo is an experimental use of this branch(https://github.com/pointfreeco/swift-snapshot-testing/pull/904) that contains a PluginAPI for `swift-snapshot-testing`.
64

75
The goal of this is to show how easy it is to build a plugin.
86

97
## Usage
108

11-
- Add this project to dependencies inside your `Package.swift` -> `.package(url: "https://github.com/mackoj/swift-snapshot-testing-plugin-heic.git", revision: "0.0.1"),`.
12-
- Then add this to your test target `.product(name: "HEICImageSerializer", package: "swift-snapshot-testing-plugin-heic"),`.
13-
- Then add this to the top of your test file `import HEICImageSerializer` and in the `setUp()` add this `SnapshotTesting.imageFormat = HEICImageSerializer.imageFormat`.
9+
To utilize the HEIC image serializer in your tests, follow these steps:
10+
11+
1. **Add the Dependency**: Include this project as a dependency in your `Package.swift` file:
12+
13+
```swift
14+
.package(url: "https://github.com/mackoj/swift-snapshot-testing-plugin-heic.git", revision: "0.0.1"),
15+
```
16+
17+
2. **Link to Your Test Target**: Add the HEICImageSerializer to your test target's dependencies:
18+
19+
```swift
20+
.product(name: "HEICImageSerializer", package: "swift-snapshot-testing-plugin-heic"),
21+
```
22+
23+
3. **Import and Set Up**: In your test file, import the serializer and set the image format in the `setUp()` method:
24+
25+
```swift
26+
import HEICImageSerializer
27+
28+
override class func setUp() {
29+
SnapshotTesting.imageFormat = HEICImageSerializer.imageFormat
30+
}
31+
```
32+
33+
4. **Per Assertion**: Alternatively, specify the image format for individual assertions:
34+
35+
```swift
36+
assertSnapshot(of: label, as: .image(precision: 0.9, format: .heic))
37+
```
1438

1539
## TODO
1640

0 commit comments

Comments
 (0)