Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update runtime warning for no liveValue. #206

Merged
merged 3 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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