Skip to content

Commit

Permalink
Update runtime warning for no liveValue. (#206)
Browse files Browse the repository at this point in the history
* Update runtime warning for no liveValue.

* wip

* wip
  • Loading branch information
mbrandonw committed Apr 15, 2024
1 parent 921a159 commit 7b6763f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
13 changes: 8 additions & 5 deletions Sources/Dependencies/DependencyValues.swift
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,15 @@ private final class CachedValues: @unchecked Sendable {
\(dependencyDescription)
Every dependency registered with the library must conform to 'DependencyKey', and \
that conformance must be visible to the running application.
To fix you can do one of two things:
To fix, make sure that '\(typeName(Key.self))' conforms to 'DependencyKey' by \
providing a live implementation of your dependency, and make sure that the \
conformance is linked with this current application.
* Conform '\(typeName(Key.self))' to the 'DependencyKey' protocol by providing \
a live implementation of your dependency, and make sure that the conformance is \
linked with this current application.
* Override the implementation of '\(typeName(Key.self))' using 'withDependencies'. \
This is typically done at the entry point of your application, but can be done \
later too.
""",
file: DependencyValues.currentDependency.file ?? file,
line: DependencyValues.currentDependency.line ?? line
Expand Down
24 changes: 14 additions & 10 deletions Tests/DependenciesTests/DependencyValuesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ final class DependencyValuesTests: XCTestCase {
Value:
Int
Every dependency registered with the library must conform to 'DependencyKey', and that \
conformance must be visible to the running application.
To fix you can do one of two things:
To fix, make sure that 'TestKey' conforms to 'DependencyKey' by providing a live \
implementation of your dependency, and make sure that the conformance is linked with \
this current application.
* Conform 'TestKey' to the 'DependencyKey' protocol by providing a live implementation \
of your dependency, and make sure that the conformance is linked with this current \
application.
* Override the implementation of 'TestKey' using 'withDependencies'. This is typically \
done at the entry point of your application, but can be done later too.
"""
}
#endif
Expand Down Expand Up @@ -71,12 +73,14 @@ final class DependencyValuesTests: XCTestCase {
Value:
Int
Every dependency registered with the library must conform to 'DependencyKey', and that \
conformance must be visible to the running application.
To fix you can do one of two things:
* Conform 'TestKey' to the 'DependencyKey' protocol by providing a live implementation \
of your dependency, and make sure that the conformance is linked with this current \
application.
To fix, make sure that 'TestKey' conforms to 'DependencyKey' by providing a live \
implementation of your dependency, and make sure that the conformance is linked with \
this current application.
* Override the implementation of 'TestKey' using 'withDependencies'. This is typically \
done at the entry point of your application, but can be done later too.
"""
}
#endif
Expand Down

0 comments on commit 7b6763f

Please sign in to comment.