Dependency overrides in preview traits don't work #156
tamasjager
started this conversation in
General
Replies: 1 comment 5 replies
-
Hi @tamasjager, we previously deprecated preview traits (pointfreeco/swift-dependencies#323) because they didn't quite work the way we expected. Then we un-deprecated them (pointfreeco/swift-dependencies#353) because we thought we had a workaround. But we've since then found more problems with preview traits, and you have found a problem too, so we feel that they just may need to be re-deprecated. A way forward is to simply use #Preview {
let _ = prepareDependencies {
$0.context = .live
}
…
} Since we plan on deprecating this API, I am going to convert this issue to a discussion. Please feel free to continue the conversation over there! |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hi! I've recently been going through the Sharing related PointFree episodes, in particular this one. When trying to force live dependencies in previews like so
the
previewValue
is still being used (both for the built-indefaultAppStorage
,defaultFileStorage
and the custom ones).Tested on Xcode 16.1 and 16.3 with both the unmodified sample code (which uses
sharing 1.0.0
) and by creating a new project which usessharing 2.5.0
.(Note that something like
also doesn't seem to work.)
Checklist
main
branch of this package.Expected behavior
Dependencies should be overridable through preview traits.
Actual behavior
Previews use the
previewValue
no matter the overrides.Reproducing project
https://github.com/pointfreeco/episode-code-samples/tree/main/0307-sharing-pt3
Sharing version information
2.5.0
Destination operating system
No response
Xcode version information
Xcode 16.3
Swift Compiler version information
Beta Was this translation helpful? Give feedback.
All reactions