-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #793 from kiwicom/792-is-snapshot-testing
- Loading branch information
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
Sources/Orbit/Support/Environment Keys/IsSnapshotTestingKey.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import SwiftUI | ||
|
||
enum IsSnapshotTestingKey: EnvironmentKey { | ||
static let defaultValue = false | ||
} | ||
|
||
public extension EnvironmentValues { | ||
|
||
/// Indicates whether the view is being rendered during snapshot testing. | ||
/// | ||
/// Used to modify the view to prevent snapshots from failing due to | ||
/// system animations or timing-related glitches. | ||
var isSnapshotTesting: Bool { | ||
get { self[IsSnapshotTestingKey.self] } | ||
set { self[IsSnapshotTestingKey.self] = newValue } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters