A dependency expanded by @DependencyClient macro can not be constructed outside itself #297
Closed
iharandreyev
started this conversation in
General
Replies: 1 comment 3 replies
-
Hi @iharandreyev, the code you have provided compiles just fine for me. Is all of this code in the same file? Or are you try to construct the Since this isn't an issue with the library I am going to convert it to a discussion. Please feel free to continue the conversation over there! |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
This is my first time trying @DependencyClient macro.
If the macro is removed, swift generates a constructor with parameters, and if
ValueGenerator<Output>()
is not used (the generated constructor with no parameters), things compile.If macro is applied, upon expanding it, there seems to be two constructors as claimed by the documentation, but they are not available outside of
ValueGenerator
scope for some reason.BTW, the same happens if 'FooReducer.State' is not declared explicitly.
An empty 'State.init()' also can't be invoked, the compiler expects 'State(from:)' decodable init.
Checklist
main
branch of this package.Expected behavior
The sample code compiles successfully
Actual behavior
The sample code does not compile with
'ValueGenerator<Int>' cannot be constructed because it has no accessible initializers error
.Steps to reproduce
Dependencies version information
1.4.1
Destination operating system
14.0
Xcode version information
16.1 (16B40)
Swift Compiler version information
Beta Was this translation helpful? Give feedback.
All reactions