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
When registering an optional property, it can not be resolved by the property wrapper even when it's available (not nil).
Example:
class Foo {
@Inject var bar: Int?
}
container.register(Int?.self) { _ in
return 42
}.inObjectScope(.container)
From the docs I assume this should be supported and I have also seen an init created for Optionals, however that init is not used. I am not sure I fully understand the rationale behind how this generic init (on line 28) is supposed to work, but I believe for optional properties to resolve properly, the wrappedValue should be of an optional type as well or the Wrapped type should be passed as an argument to the generic init method, otherwise it is not used anywhere in the method body.
Looking forward to your reply, thanks.
The text was updated successfully, but these errors were encountered:
When registering an optional property, it can not be resolved by the property wrapper even when it's available (not nil).
Example:
From the docs I assume this should be supported and I have also seen an
init
created forOptionals
, however thatinit
is not used. I am not sure I fully understand the rationale behind how this generic init (on line 28) is supposed to work, but I believe for optional properties to resolve properly, thewrappedValue
should be of an optional type as well or the Wrapped type should be passed as an argument to the genericinit
method, otherwise it is not used anywhere in the method body.Looking forward to your reply, thanks.
The text was updated successfully, but these errors were encountered: