We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
.dependency(Value.self)
1 parent 3abf6f3 commit e2b0609Copy full SHA for e2b0609
Sources/Dependencies/Traits/PreviewTrait.swift
@@ -26,6 +26,15 @@
26
.dependencies { $0[keyPath: keyPath] = value }
27
}
28
29
+ /// A trait that overrides a preview's dependency.
30
+ ///
31
+ /// - Parameter value: A dependency value to override for the test.
32
+ public static func dependency<Value: TestDependencyKey>(
33
+ _ value: Value
34
+ ) -> PreviewTrait where Value == Value.Value {
35
+ .dependencies { $0[Value.self] = value }
36
+ }
37
+
38
/// A trait that overrides a preview's dependencies.
39
///
40
/// Useful for overriding several dependencies in a preview without incurring the nesting and
0 commit comments