You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible to do something like this, where the argument passed to the dependency container when trying to resolve a dependency is typed as a protocol?
protocolArgumentType{}structDependency{}letcontainer=Container()
container.register(Dependency.self){(container:ResolverType, argument:ArgumentType)inreturnDependency()}extensionString:ArgumentType{}letdependency= container.resolve(Dependency.self, argument:"I’m the argument!")
This fails to find the registered dependency, this way. If I change the registration to specify String as the argument type, instead of ArgumentType:
Hello,
It is possible to do something like this, where the argument passed to the dependency container when trying to resolve a dependency is typed as a protocol?
This fails to find the registered dependency, this way. If I change the registration to specify
String
as the argument type, instead ofArgumentType
:Then it resolves as expected.
Please advise – thank you!
The text was updated successfully, but these errors were encountered: