Skip to content

Commit bc43bda

Browse files
committed
update for new resources bridge
1 parent 8bae13f commit bc43bda

File tree

6 files changed

+18
-97
lines changed

6 files changed

+18
-97
lines changed

.github/workflows/release_cocoapods.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let package = Package(
1818
.package(url: "https://github.com/devicekit/DeviceKit.git",
1919
.upToNextMinor(from: "4.2.1")),
2020
.package(url: "https://github.com/eugenebokhan/ResourcesBridge.git",
21-
.upToNextMinor(from: "0.0.3"))
21+
.upToNextMinor(from: "0.0.4"))
2222
],
2323
targets: [
2424
.target(name: "SwiftSnapshotTesting",

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ Internally `SwiftSnapshotTesting` operates with [`MTLTextures`](https://develope
2222
* Swift `5.2`
2323
* iOS `11.0`
2424

25-
## Install via [`Cocoapods`](https://cocoapods.org)
25+
## Install via [SwiftPM](https://swift.org/package-manager/)
2626

27-
```ruby
28-
pod 'SwiftSnapshotTesting'
27+
```swift
28+
.package(url: "https://github.com/eugenebokhan/SwiftSnapshotTesting.git",
29+
.upToNextMinor(from: "0.1.6"))
2930
```
3031

3132
## How To Use
@@ -75,6 +76,15 @@ pod 'SwiftSnapshotTesting'
7576
* `screenshot` - screenshot to test.
7677
* `ignorables` - UI elements to ignore. `Ignorable` can be `XCUIElement`, custom `CGRect` or predefined `.statusBar`.
7778

79+
## Info.plist configuration
80+
81+
In order for `SwiftSnapshotTesting` to work when running on iOS 14, you will have to include two keys in your app's Info.plist file.
82+
The keys are `Privacy - Local Network Usage Description` (`NSLocalNetworkUsageDescription`) and `Bonjour services` (`NSBonjourServices`).
83+
For the privacy key, include a human-readable description of what benefit the user gets by allowing your app to access devices on the local network.
84+
The Bonjour services key is an array of service types that your app will browse for. For `SwiftSnapshotTesting`, he value of this key should be `_ResourcesBridge._tcp`.
85+
86+
**If you do not configure the above keys properly, then `SwiftSnapshotTesting` won't work on real devices.**
87+
7888
# XCTAttachment
7989

8090
After each assertion test `SnapshotTestCase` provides an attachment containing per-pixel L2 distance between snapshot and the corresponding reference and `MTLTexture` with highlighted difference. You are able to look at the diff using [`MTLTextureViewer`](https://github.com/eugenebokhan/MTLTextureViewer/).

Scripts/get_version.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

Sources/SwiftSnapshotTesting/SnapshotTestCase.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ open class SnapshotTestCase: XCTestCase {
205205
recording: Bool = false) throws {
206206

207207
#if !targetEnvironment(simulator)
208-
self.bridge.waitForConnection()
208+
try self.bridge.waitForConnection()
209209
#endif
210210

211211
let fileExtension = ".compressedTexture"
@@ -249,8 +249,8 @@ open class SnapshotTestCase: XCTestCase {
249249

250250
try textureData.write(to: referenceURL)
251251
#else
252-
try self.bridge.writeResourceSynchronously(resource: textureData,
253-
at: referenceScreenshotPath) { progress in
252+
try self.bridge.writeResource(textureData,
253+
at: referenceScreenshotPath) { progress in
254254
#if DEBUG
255255
print("Sending reference: \(progress)")
256256
#endif
@@ -266,7 +266,7 @@ open class SnapshotTestCase: XCTestCase {
266266
#if targetEnvironment(simulator)
267267
data = try Data(contentsOf: URL(fileURLWithPath: referenceScreenshotPath))
268268
#else
269-
data = try self.bridge.readResourceSynchronously(at: referenceScreenshotPath) { progress in
269+
data = try self.bridge.readResource(from: referenceScreenshotPath) { progress in
270270
#if DEBUG
271271
print("Receiving: \(progress)")
272272
#endif

SwiftSnapshotTesting.podspec

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)